What is the Purpose of bin Directory

In Linux, the “bin” (binaries) is the directory composed of executable files. These files store the encoded machine code in binaries executed in the system. The binary language is not understandable for the users but systems can understand it. There are various “bin” directories available in Linux such as ”/bin”, “/sbin”, “/usr/bin”, “/usr/sbin”, “/usr/local/bin” and “/usr/local/sbin”.

This post will enlighten the purpose of all the bin directories in Linux distributions.

  • What is the Purpose of Binary Directories in Linux?
  • How to View Binary Files in Linux?

Purpose of Binary Directories in Linux

As mentioned earlier, bin directories have various types based on location. The purpose of each binary directory is described in the below section.

/bin”: The “/bin” directory contains the executable binary files that are part of the core operating system like commands such as “cp”, “mv”, and  “apt”, etc. 

“/sbin”: The “sbin” directory contains executable binary files for booting, repairing, restoring, and recovering the Linux system.

“/usr/bin”: the “/usr/bin” directory contains executable binary files that are required for the logged-in users same as the “/bn”

 “/usr/sbin”: The “/usr/sbin” directory stores the binary files related to the administrative commands that are only executed by the sudo (root) users.

“/usr/local/bin”: The “/usr/local” directory holds third-party applications/software installation files. The executable binaries for these applications are stored in the “/usr/local/bin” directory.

“/usr/local/sbin”: The “/usr/local/sbin” directory holds the binary files of installed programs for system administration.

How to View the Binary Files in Linux?

To view any binary files in Linux, the user can use the “xxd” command. By default, it displays the file output in hexadecimal format, to convert the result into binary, use the “b” flag and specify the binary file name.

The following command will display the output of the “ls” binary file:

$ xxd -b /bin/ls

The binary output for the “ls” binary file is listed.

Note: To analyze the binary files in Linux read our latest article here


The “bin” directory contains the executable binary files of various types which depend upon the location where the “bin” directory exists. These include ”/bin”, “/sbin”, “/usr/bin”, “/usr/sbin”, “/usr/local/bin” and “/usr/local/sbin” which can be viewed using the “xxd” command. The purpose of all these directories is explained in the guide.