Forrest logo
back to the nm tool

nm:tldr:9691a

nm: List global (extern) functions in a file (prefixed with T).
$ nm -g ${filename-o}
try on your machine

The command nm -g ${filename-o} is used to display the symbols (functions and variables) present in an object file or an executable file. Here is an explanation of each component of the command:

  • nm: This is the command itself, which stands for "name list." It is typically used in Unix-like systems to list symbols from object files.

  • -g: This option is used to display global symbols only. It filters out local symbols that are not accessible outside the object file or executable.

  • ${filename-o}: This is a parameter or variable (indicated by the ${} syntax) that represents the name of the file for which you want to display symbols. The -o part provides a default value of "o" in case the filename variable is not set or empty. You can replace filename with the actual name of the file you wish to analyze.

By running this command, you will get a list of global symbols present in the specified file, which can be useful for various purposes, such as debugging, analyzing dependencies, or understanding the structure of an object or executable file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nm tool