some useful Commands In GCC Compiling under Linux
2013-04-10
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
- linux-gate.so.1 => (0x007e9000)
- libtinfo.so.5 => /lib/i386-linux-gnu/libtinfo.so.5 (0x00682000)
- libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x00110000)
- libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00115000)
- /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...
- locate somefile
- updatedb
grep --- find a file by its contents
it's coming coming...