leafleafDocy banner shape 01Docy banner shape 02Flower illustration
Other

Linux Binary Directories Explained

Binaries

They 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

/bin

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.

/sbin

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.

/lib

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, ld-linux.so.2 and libfuse.so.2.8.6. Below is an example of the partial contents of /lib.

$ ls /lib/libc*

/lib/libc-2.5.so /lib/libcfont.so.0.0.0 /lib/libcom_err.so.2.1

/lib/libcap.so.1 /lib/libcidn-2.5.so /lib/libconsole.so.0

/lib/libcap.so.1.10 /lib/libcidn.so.1 /lib/libconsole.so.0.0.0

/lib/libcfont.so.0 /lib/libcom_err.so.2 /lib/libcrypt-2.5.so

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.

/opt

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.

Share this Doc

Linux Binary Directories Explained

Or copy link

Table Of Contents