Linux Binary Directories Explained

Posted at March 4, 2017 at 12:25 am by Jithin

Binaries are files that contain compiled source code (or machine code). Binary files are the files which contain compiled source code (or machine code). They are also called executable files because they can be executed on the computer.

Binary directory contains following directories:

  • /bin
  • /sbin
  • /lib
  • /opt



The /bin directory contains binaries for use by all users. The ‘/bin’ directory also contains executable files, Linux commands that are used in single user mode, and common commands that are used by all the users, like cat, cp, cd, ls, etc. According to the FHS the /bin directory should contain /bin/cat and /bin/date (among others). The ‘/bin’ directory doesn’t contain directories.


Other /bin directories

You can find a /bin subdirectory in many other directories. A user named Amy could put her own programs in /home/amy/bin. Some applications, often when installed directly from source will put themselves in /opt. A samba server installation can use /opt/samba/bin to store its binaries.



The /sbin contains binaries to configure the operating system. The ‘/sbin’ directory also contains executable files, but unlike ‘/bin’ it only contains system binaries which require root privilege to perform certain tasks and are helpful for system maintenance purpose. e.g. fsck, root, init, ifconfig, etc. Many of the system binaries require root privilege to perform certain tasks.



The ‘/lib’ directory contains shared libraries which are often used by the ‘/bin’ and ‘/sbin’ directories. It also contains kernel module. These filenames are identable as ld* or lib*.so.*. For example, and Below is an example of the partial contents of /lib.

$ ls /lib/libc*

/lib/     /lib/  /lib/

/lib/     /lib/     /lib/

/lib/  /lib/       /lib/

/lib/   /lib/    /lib/


1) /lib/modules: The ‘/lib/modules’ stores kernel modules and has a directory for each installed kernel. Typically, the Linux kernel loads kernel modules from /lib/modules/$kernel-version/. Modules are meant to use extra hardware support without making a new kernel.

2) /lib32 and /lib64: We currently are in a transition between 32-bit and 64-bit systems. During compilation time of libraries, you’ll encounter through the directories named ‘/lib32’ and ‘/lib64’ which will clarify register size to be used. A 64-bit system may have compatibility for 32-bit binary.



The term ‘opt’ is short for optional. Its main purpose is to store optional application software packages. In many cases this is software from outside the distribution repository. Add-on applications from individual vendors should be installed in ‘/opt’. In some systems ‘/opt’ is empty as they may not have any add-on application. A large package can install all its files in /bin/lib/etc subdirectories within /opt/$packagename/. If for example the package is called wp, then it installs in /opt/wp, putting binaries in /opt/wp/bin and man pages in /opt/wp/man.


If you need any further help please reach our support department.



0.00 avg. rating (0% score) - 0 votes

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply