Forrest logo
tool overview
On this page you find all important commands for the CLI tool nm. If the command you are looking for is missing please ask our AI.

nm

'nm' is a command line tool used on Unix-like systems to analyze and display information about object files. It stands for "name list" and provides details about the symbols defined and used in a compiled program.

  1. One primary use of 'nm' is to list the symbols (functions, variables, etc.) present in an object file or an executable.
  2. It can be used on various types of object files, including static libraries, shared libraries, and executables.
  3. The output of 'nm' includes the name of each symbol, its type (function, data, etc.), and its virtual memory address.
  4. The tool categorizes symbols as either external (visible outside the object file) or internal (only visible within the file).
  5. 'nm' can display the symbols in various formats, including raw symbol table format, hexadecimal, or demangled C++ symbols.
  6. It can also provide additional information about each symbol, such as size, sections, and associated files.
  7. By default, 'nm' displays symbols in alphabetical order, but it can also sort them by address or by type.
  8. The tool can be used to verify symbol dependencies, check for missing or duplicate symbols, and inspect the symbol table of an executable.
  9. 'nm' can be combined with other tools, such as 'grep' and 'sed', to filter or modify the output based on specific criteria.
  10. It is a versatile and powerful tool that aids in understanding and debugging compiled programs by examining their symbol tables.

List of commands for nm:

  • nm:tldr:9691a nm: List global (extern) functions in a file (prefixed with T).
    $ nm -g ${filename-o}
    try on your machine
    explain this command
  • nm:tldr:9e99c nm: List only undefined symbols in a file.
    $ nm -u ${filename-o}
    try on your machine
    explain this command
  • nm:tldr:ba4c9 nm: Demangle C++ symbols (make them readable).
    $ nm --demangle ${filename-o}
    try on your machine
    explain this command
  • nm:tldr:e33a3 nm: List all symbols, even debugging symbols.
    $ nm -a ${filename-o}
    try on your machine
    explain this command
tool overview