To understand system directories in Linux, it is important to understand that Linux is entirely based on files. This is a fundamental difference from a Windows OS, where the system is based on a combination of executable files, application files, and text files - each of them with its own properties and functions.

Linux, on the other hand, considers everything a file that can be read from or written to, whether it is a document, a directory, a hardware device, or a running process. If it is in Linux, it is a file.

This, of course, can present some organisational challenges, like an archive with papers and books randomly stacked. To solve the issue, Linux implements the system directories to located required files when needed, and are therefore an essential component of the system - used to manage core functionality such as booting, interacting with devices, sharing libraries, and processing information.

Although there are many different versions of Linux, there is a basic standard called the File System Hierarchy that most distributions follow. The FHS defines how things are organised across FHS-compliant distributions with standard dir names and use cases.

/root

The / directory is considered the root of the file system, and every other directory in the Linux FHS branches off from here. It serves as the top-level directory, and everything in the system is accessible from here.

/boot

The boot directory contains boot loader files, with files required to start the operating system, including:

PathUse
/boot/initrd.imgRAM Disk
/boot/vmlinuzLinux kernel
/boot/grub/grub.cfgBootloader config

/bin, /sbin

Essential user binaries are located in /bin; a directory that contains critical executable programs required for basic system functionality. This includes stuff like ls, cp, mv, cat, etc.

/sbin is similar to /bin, except that it is for commands primarily used by the root user1. Commands here include stuff like fsck, reboot, iptables, and mount.

/lib

Shared libraries and kernel modules are located at /lib. These are essential shared libraries required by programs in /bin, /sbin.

/dev

This contains special files that represent hardware devices. It allows programs to treat the physical devices as though they were files like anything else in Linux. It contains stuff like:

PathDescription
/dev/sdaFirst hard disk
/dev/tty1First terminal interface
/dev/nullDiscard output
/dev/randomRandom number generator
In general, these files serve as an interface between software and hardware

/proc

proc files are used to provide real-time system information, such as cpuinfo, meminfo, uptime, and [PID] for information about specific processes.

/etc

System configuration directories are stored in /etc and they determine the behaviour of the system. Important files here include:

PathDescription
/etc/passwdUser account details
/etc/shadowPassword information
/etc/hostsHostname-to-IP maps
/etc/fstabFilesystem mount-points
/etc/ssh/sshd_configSSH service configuration

Footnotes

  1. Although this is a fairly standard description, modern distributions may not follow it exactly. Some of them don’t differentiate between /bin/ and /sbin.