Linux Filesystem Hierarchy

Familiarising yourself with the Linux filesystem hierarchy is very useful, especially if you’re working in DevOps, system administration roles. It helps you:
Troubleshoot system issues
Understand logs and services
Write correct paths in scripts/configs
Debug package installations, system performance, etc.
Overview of Important Linux Directories
Directory | Purpose | Typical Use |
/ | Root of the entire filesystem | Everything starts here |
/bin | Essential user binaries | Commands like ls , cp , mv , etc. |
/sbin | System binaries | Commands for system admin (e.g., reboot , ifconfig ) |
/etc | Configuration files | Configs for system and apps (e.g., /etc/hosts , /etc/nginx/ ) |
/dev | Device files | Represents hardware (e.g., /dev/sda , /dev/null ) |
/proc | Kernel and process info (virtual) | Runtime system info like /proc/cpuinfo |
/sys | System info (virtual) | Exposes hardware/driver info from kernel |
/lib , /lib64 | Essential shared libraries | Needed for binaries in /bin , /sbin |
/usr | Unix System Resources and data | Non-essential apps and libraries (/usr/bin , /usr/lib ) |
/var | Variable data | Logs, mail, cache (/var/log , /var/cache ) |
/tmp | Temporary files | Deleted at boot, used by apps |
/home | User home directories | e.g., /home/vishnu |
/root | Root user’s home | Not the same as / |
/opt | Optional software | Third-party apps |
/boot | Boot files | Kernel, initramfs, GRUB |
/media , /mnt | Mounted filesystems | For USB drives, external partitions |
Simple short-forms to help retain:
/etc
= “etcetera” → miscellaneous configs/var
= “variable” → data that changes often/usr
= “unix system resources” (historically, not just userland)/dev
= “devices”/proc
= “processes” (runtime virtual info)
What about /var
and /lib
? and /var/lib
?
/var
, /lib
, and /var/lib
are critical parts of the Linux filesystem, and it's very helpful to know how they relate and differ.
/var
As the name suggest
/var
stores variable (changing) data or the things that grow or change during system operationThis is opposite of
/usr
, which is static and read-only post-install
/lib
stores essential shared libraries needed by binaries in
/bin
and/sbin
, you can think of it as a place to hold core system libraries.Without
/lib
, the system can’t even boot properly
/var/lib
While
/lib
stores shared libraries and system libraries,/var/lib
stores stateful runtime data for system services and appsThis is where where services track what they're doing
eg:
/var/lib/docker
is where docker service stores all it’s runtime variable data like volume, images and even overlays.
It is useful to understand this diff especially for DevOps engineers while working with services like docker!!
While it is useful to familiarise with these commands, I do not think memorising them would stick with you as you often tend to forget things that you don’t use, so instead I recommend bookmarking this article for reference while actively poking around an actual systems, exploring these directories as you work on day to day tasks and this will help you stick with it in the long run as you are figuring out details about each directory as your requirements instead of directly asking chat-gpt to find it for you.
Subscribe to my newsletter
Read articles from Vishnu Mohan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Vishnu Mohan
Vishnu Mohan
Software Engineer | Cloud Security