π Linux Root Directory Structure (/)
| Directory | Purpose |
|---|---|
/ |
The root of the entire file system β everything starts here. |
/bin |
Essential user command binaries (e.g. ls, cp, mv) used in single-user mode. |
/boot |
Files needed to boot the system (e.g. grub, vmlinuz, initrd). |
/dev |
Special files that represent hardware devices (e.g. /dev/sda, /dev/null). |
/etc |
System-wide configuration files (e.g. /etc/passwd, /etc/ssh/sshd_config). |
/home |
Default location for user home directories (e.g. /home/alice). |
/lib, /lib64 |
Essential shared libraries needed by binaries in /bin and /sbin. |
/media |
Mount point for removable media (e.g. USB drives, CDs). |
/mnt |
A general-purpose temporary mount point (used by admins for mounting manually). |
/opt |
For optional third-party software or add-on packages. |
/proc |
A virtual filesystem exposing kernel and process info (e.g. /proc/cpuinfo). |
/root |
The home directory for the root user. Not the same as /. |
/run |
Stores runtime data like PIDs and sockets (cleared on reboot). |
/sbin |
Essential system binaries used by root/admin (e.g. fsck, reboot). |
/srv |
Contains data for services (e.g. FTP, web servers). Rarely used by default. |
/sys |
Like /proc, but for exposing kernel/device info (virtual filesystem). |
/tmp |
Temporary files. Usually cleared on reboot. |
/usr |
Contains non-essential system files: user binaries, libraries, docs. See below. |
/var |
Variable data: logs, mail, spool files, caches β stuff that changes frequently. |
π More on /usr β Whatβs Inside?
/usr = Unix System Resources, not “user” as some think.
| Subdirectory | Purpose |
|---|---|
/usr/bin |
Most user command-line binaries (e.g. python, vim) |
/usr/sbin |
System binaries for administrative tasks (e.g. apache2) |
/usr/lib, /usr/lib64 |
Libraries for programs in /usr/bin and /usr/sbin |
/usr/share |
Architecture-independent data like icons, docs, man pages |
/usr/local |
Locally installed software (built from source, custom tools) |