Shihui Guo

some useful Commands In GCC Compiling under Linux

ld --- Listing the gcc library search path

ld --verbose | grep SEARCH

For example, in my computer, it returns like

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

shepherd@shepherd-laptop:~$ ldd /bin/bash =>  (0x007e9000) => /lib/i386-linux-gnu/ (0x00682000) => /lib/i386-linux-gnu/ (0x00110000) => /lib/i386-linux-gnu/ (0x00115000)
	/lib/ (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...

locate somefile


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