RHCSA – Binary files (aka executables)

In Linux a lot of files, especially the underlying files represented by shell commands are in the form of a non-human readable binary file, which is also referred to as an executable. The humble “pwd” command is a typical example:


You can find all my latest posts on medium.
$ type pwd
pwd is a shell builtin
$ which pwd

The above “pwd” file appears to be binary file, since it’s in the (bin)ary folder. But this may not always be the case. A better way to determine whether a file is a binary/executable or not is by using the “file” command.

The “file” command

$ whatis file
file (1)             - determine file type


$ file /usr/bin/pwd
/usr/bin/pwd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x9a42cda95a4835fcef88198eecf0bd7191e8d3dc, stripped

the “ldd” command

The people who have developed binary files, such as pwd, usually re-use code provided by others. These third party codes provided by others are usually packaged into “libraries”.

The ldd (List Dynamic Dependencies) command displays the shared libraries required by each program:

$ whatis ldd
ldd (1)              - print shared library dependencies
$ ldd --help
Usage: ldd [OPTION]... FILE...
      --help              print this help and exit
      --version           print version information and exit
  -d, --data-relocs       process data relocations
  -r, --function-relocs   process data and function relocations
  -u, --unused            print unused direct dependencies
  -v, --verbose           print all information

For bug reporting instructions, please see:

Hence for pwd, we have:

$ ldd /usr/bin/pwd =>  (0x00007fffadbfe000) => /lib64/ (0x00007f5a9f34d000)
    /lib64/ (0x00007f5a9f721000)

See also