How to find out more about a given binary
All you ever wanted to know about a given binary.
Command | Description / Example |
---|---|
which | Looks at your $PATH and displays which executable you will get
# which ld /usr/bin/ld |
whereis | Looks in a bunch of standard places to give a clue about where something is
# whereis ld ld: /usr/bin/ld |
what | Prints out version info from binary
# what /usr/bin/ld /usr/bin/ld: |
ldd | List dynamic dependencies tells you what libraries it wants and where it is expecting to find them
# ldd /usr/bin/ld -lc.1 => /usr/lib/libc.so.1.10 -ldl.1 => /usr/lib/libdl.so.1.0 |
file | Makes a guess about file contents. Uses /etc/magic
# file /usr/bin/ld /usr/bin/ld: sparc depend paged dynamically linked |
size | How big is an executable
# size /usr/bin/ld text data bss dec hex 122880 32768 40104 195752 2fca8 |
nm | name list — doesn't have one if stripped
# nm /usr/bin/ld nm /usr/lib/libc.so.1.10 000015f8 T .div 00000790 T .mul 00027798 T .ptr_call 000024d8 T .rem 00022c08 T .stret1 : : |
version | version info — only for SPARCcompilers
# version `which CC` version-id of "/opt/SUNWspro/bin/CC": SC2.0.1 |
showrev | Print the revision info for command
# showrev -c /usr/bin/ld PATH is: /usr/sbin:/usr/bin:/usr/dt/bin:/bin:/usr/ucb PWD is: / LD_LIBRARY_PATH is not set in the current environment ------------------------------------------------------------- File: /usr/bin/ld ================= File type: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped Command version: SunOS 5.8 Generic February 2000 File mode: r-xr-xr-x User owning file: root Group owning file: bin Library information: libc.so.1 => /usr/lib/libc.so.1.10 ldl.1 => /usr/lib/libdl.so.1.0 Sum: 48668 |