nm [options] [objfiles]

Print the symbol table (name list) in alphabetical order for one or more object files. If no object files are specified, perform operations on a.out. Output includes each symbol’s value, type, size, name, and so on. A key letter categorizing the symbol can also be displayed.


-a, --debug-syms

Print debugger symbols.


Display only defined symbols.

-f format, --format= format

Specify output format (bsd, sysv, or posix). Default is bsd.

-g, --extern-only

Print external symbols only.


Print help message, then exit.

-l, --line-numbers

Print source filenames and line numbers for each symbol from available debugging information.

-n, -v, --numeric-sort

Sort the external symbols by address.

-p, --no-sort

Don’t sort the symbols at all.

-r, --reverse-sort

Sort in reverse, alphabetically or numerically.

-s, --print-armap

Include mappings stored by ar and ranlib when printing archive symbols.


Sort by size.

-t radix, --radix= radix

Use the specified radix for printing symbol values. Accepted values are d for decimal, o for octal, and x for hexadecimal.

--target= format

Specify an object code format other than the system default.

-u, --undefined-only

Report only the undefined symbols.

-A, -o, -print-file-name

Print input filenames before each symbol.

-C, --demangle[= style]

Translate low-level symbol names into readable versions. You may specify a style to use when demangling symbol names from a foreign compiler.

-D, ...

Get Linux in a Nutshell, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.