When we install a Linux distribution, we see that a number of directories are created. These created directories may be the same or partially different on various Linux distributions. You might know about the directory structures & what purpose they serve.

For those of you who don’t know about the Linux directory structure or have partial knowledge or just want to relook on Linux directory structure & its usage, this article will act as a reference guide.

We will start out this article with the Linux directories/partitions that are a must for every Linux system & are required for the Linux system to work properly.

These partitions are ‘/’ (root), ‘/boot’, ‘/swap’. Though the ‘/’ (root), ‘/boot’ partitions are absolutely required but a system might work without a swap partition. However, it's recommended that we have one for our Linux system.

linux directory structure explained

Now let’s start out with these Linux partitions & their purpose,

(Recommended Read: Linux Commands for Beginners (Part 1) )

(Also Read: Linux Commands for Beginners (Part 2) )


Linux Directory structure explained

  • ‘/’ (root) - / or root partition is one of the most important partitions for a Linux machine. This is the partition where all other Linux partitions are. So this is the basis of Linux directory structure.
  • ‘/boot’- Another important partition, boot partition contains all the startup files, kernel files & VMLinuz. In the recent, new Linux distribution, it also holds the Grub data as well.
  • ‘/swap’- Swap partition acts as a virtual memory/RAM for the system & is used when your system runs out of the physical RAM. Though usually, it’s a separate partition, we can also use a file to act as swap space.

The above-mentioned are the bare minimum partitions that are required to run a Linux system. Below mentioned are other partitions in Linux directory structure,

  • ‘/root’- This is the home directory/partition for the administrative user i.e. root.
  • ‘/home’- This is the directory that contains the home directory for all users other than superuser root.
  • ‘/etc’- These partitions hold all the important configuration files for the system. One can also compare this partition to the control panel on the Windows system.
  • ‘/bin’- This directory contains the common programs that are shared among administrative users, common users & the system.
  • ‘/sbin’- contains all the programs that are used by the system & system administrators.
  • ‘/initrd’- This directory contains the system library files, files for the system that are needed by the system or other programs to run.
  • ‘/mnt’- this directory acts as a default mount point for all external devices like USB storage devices, CD-DVD ROM, etc.
  • ‘/opt’- It's used as an installation folder for extra software & 3rd party software.
  • ‘/var’- This folder is the default storage for all the variable files created by users, like log files, mail queue, etc. This folder also contains some temporary files.
  • ‘/proc’- This virtual file system contains complete information regarding the system resources.
  • ‘/tmp’- This partition acts as a temporary space for use by the system. Files are stored temporarily on this partition & are cleaned after every reboot.
  • ‘lost+found’- Every partition has a lost+found directory in its upper directory. This serves as storage for those files that were saved during failures.
  • ‘/usr’ – This partition mainly has all documentation of user-related programs. It also contains some user-related programs & libraries.
  • ‘/misc’- This partition is used by the system for miscellaneous purposes.

This is our article that will act as a reference guide for Linux directory structure. Please feel free to send in any questions or queries you have using the comment box below. Suggestions are also welcome.

We are giving you exclusive deals to try Linux Servers for free with 100$ credit, check these links to claim your 100$,

DigitalOcean - 100$ free credit & Linode - 100$ free credit

Check some Exclusive Deals, HERE.

Also, check out DevOps Book You should read section.