addr2line command in Linux is used for converting program addresses into file names or line numbers, as its name indicates (Address 2 line). So, when this command is executed with a given address along with an executable, it uses the debugging information in specified executable file to find out the file name and line number associated with given address. This means that using addr2line command in Linux, one can map the address of the machine instruction to line of file from which it’s originated.
Syntax of addr2line command in Linux
addr2line [options] [addr(s)]
Various modes of using addr2line commands
There are two modes in which the addr2line command works in Linux platforms, as mentioned below:
- In first mode, the hexadecimal addresses are specified on the command line and addr2line shows the file name and line number for each address.
- In the second mode, the command reads through the hexadecimal addresses from an standard input and prints the file name and line number of each address in standard output. Within this mode, the command can also be used in a pipe to convert chosen addresses dynamically.
Available options to use addr2line command in Linux
- -a | -addresses: Displays addresses
- -b | -target: Sets the binary file format
- -e | -exe: Sets the input file name (The default one is .out)
- -i | -inlines: Allows to unwind inlined functions
- -j | -section: Reads the offsets relatives to specified section
- -p | -pretty-print: Makes the output readable for humans
- -s | -basenames: Strips directory names
- -f | -functions: Displays function names
- -c | -demangle: Used to demangle function names
- -h | -help: Shows help details
- -v | -version: Shows the program’s version

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.