• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

nm : Command to list the symbols in object files.

by admin

nm displays the name list (symbol table of nlist structures) of each object file in the argument list. If you want to peep into an object file and see what are the various symbols that are defines in it the command will come handy. It takes an object file as input and lists out all the symbols, their address and in which section, text,data,uninitialized etc, is the symbol present in as the output.

For example let us assume we have an object file “hello.o” for the simple hello world program hello.c.

#include<stdio.h>
main()
{
printf("Hello world");
}

Running “nm” on the hello.o will yield:

$ nm hello.o
00000000 T main
                U printf

T before “main” signifies it is in the text section and the “U” before printf means it is undefined in this code. The first column gives the value of the symbol.

For more information on the command, please check the man page:

# man nm

Filed Under: C, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to exclude kernel or other packages from getting updated using YUM Versionlock Plugin
  2. How to Run a Script When USB Devices Is Attached or Removed Using UDEV
  3. How to Install Cockpit’s Web Console in CentOS/RHEL 8
  4. How to recreate LVM device files under /dev directory using vgmknodes
  5. CIFS Share Filesystem Is Not Mounted after Reboot on CentOS/RHEL 7
  6. 14 Useful “cat” Command Examples in Linux
  7. How to scan newly Assigned LUNs in Multipathd under CentOS / RHEL
  8. Linux OS Service ‘anacron’
  9. logrotate Command Examples in Linux
  10. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright