• Introduction to Linux directory structure
• Different Linux directories
Introduction to Linux Directory Structure
Most of the people who use computers are familiar with the file system of Windows. In Windows, files and directories are stored in separate drives.
In Windows, the names of these drives are determined. They store directories and files related to the C drive operating system. Similarly, there are other drives.
In Windows, the path (address) of any type of file starts with the name of a drive. That is, drivers are only at the top of the Windows file system. This is followed by directories and then files.
But Linux’s file system is different from Windows. In Linux, files are stored and organized as a directory structure. Linux does not have any type of drive.
Linux has only directories. The root directory is at the top of them. All other directories are inside this directory.
Within the root directory, there are directories related to different tasks that store the files related to that task.
Different Linux Directories
All the directories available in the Linux directory structure are briefly explained further. Here the original names of directories which are short form and detailed names are being given so that you can understand their usage easily.
/ – Root
In Linux, any directory or file starts the root directory. The root directory represents a single slash (/).
Many / root and / (root) are treated as one. But it is not so that / root in Linux is the home directory of a root (administrator) user.
/ bin – User Binaries
The binary executable files are stored in this directory. These binary files represent the common Linux commands used by a single user.
In simple words, the binary files used by the user are stored in this directory.
/ sbin – System Binaries
This directory stores executable files related to the system binaries. These binary files represent commands that are mainly used by the administrator for system maintenance.
/ etc – Configuration Files
This directory contains Linux configuration files that are used by different applications. The configuration files of all the applications are available in this directory. This directory also has shell scripts to start and end different applications.
/ dev – Devices Files
Files related to different devices are stored in this directory. For example, files related to devices like USB, mouse, keyboard, and WebCam, etc. are stored in the same directories.
/ proc – Process Information
System-related processes are stored in this directory. Each process has an id that helps to uniquely identify that process.
Each process id in this directory is stored as a separate directory.
/ var – Variable Files
Such files whose content is changed are stored in this directory. For example, log files that change continuously are stored inside this directory.
/ tmp – Temporary Files
In this directory, temporary files created by the user and system are stored. These files are also deleted as soon as the system is restarted.
/ usr – User Programs
Files related to programs installed by the user are stored in this directory. These are the programs that the user installs for their own use and these programs are of no use for the system.
Inside this directory, there are / bin, / sbin, / lib and / local, etc. directories which store binary files, system binary files, libraries and local files related to user programs respectively.
/ home – Home Directory
This is the home directory of all users. Directories are created in this directory under the name of the user. For example, if a user is Ravi, then the directory will be created in this directory under the name / Ravi.
Users’ personal files are stored in the home directory.
/ boot – Boot Loader Files
In this directory, files are stored which are helpful for booting the system. These files are accessed and used by the kernel during system bootup.
/ lib – System Libraries
In this directory, libraries related to system programs and binary files are stored. The name of a library file is mostly defined with lib extension.
/ opt – Optional Add-On Applications
Optional or extra add-on programs are stored in this directory. Different vendors have different add-on programs in the Linux version.
/ mnt – Mount Directory
It is temporarily used by directory administrators to mount file systems.
/ media – Removable Media Devices
This directory stores removable media devices such as USB etc. These directory removable media devices are temporarily mounted.
/ srv – Service Data
Server-related service data is stored in this directory. Data related to server services such as internet etc. are stored in this directory.