Shihui Guo

some useful Commands In GCC Compiling under Linux

ld --- Listing the gcc library search path

  1. ld --verbose | grep SEARCH

For example, in my computer, it returns like

  1. SEARCH_DIR("/usr/i686-linux-gnu/lib32"); SEARCH_DIR("=/usr/local/lib32"); SEARCH_DIR("=/lib32"); SEARCH_DIR("=/usr/lib32"); SEARCH_DIR("=/usr/local/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib/i386-linux-gnu"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/lib");

ldd --- List the libraries which an executive program needs when running

  1. shepherd@shepherd-laptop:~$ ldd /bin/bash
  2. linux-gate.so.1 => (0x007e9000)
  3. libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0x00682000)
  4. libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x00110000)
  5. libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00115000)
  6. /lib/ld-linux.so.2 (0x0075c000)

locate --- find a file by filename
locate is a simple command to search file in linux. Use updatedb to update the database which locate uses to search. But don't use updatedb too often because it reads your whole disk...

  1. locate somefile
  2.  
  3. updatedb

grep --- find a file by its contents
it's coming coming...

点击查看评论