🐧 LINUX • BEGINNER GUIDE

Linux File System Hierarchy

Understand the Linux directory structure from / to /var — what each directory stores, why it exists, and which paths DevOps engineers use every day.

A practical Filesystem Hierarchy Standard (FHS) guide for Linux beginners
Linux File System Hierarchy infographic
Linux filesystem hierarchy at a glance — the root directory branches into system binaries, configuration, devices, user data, libraries, runtime data and more.

What Is the Linux File System?

Linux organizes files and directories into a single hierarchical tree. Unlike Windows, where drives commonly appear as C:, D:, and so on, Linux starts from one top-level directory called the root directory, written as /.

Everything in the Linux filesystem is located somewhere under /. Hardware devices, configuration files, applications, logs, user home directories and temporary files all have conventional locations.

Core idea: Linux has one filesystem tree. The directory / is the starting point, and every other directory branches from it.

1. / — The Root Directory

The root directory is the top of the Linux filesystem hierarchy. It contains the major system directories needed to boot and operate the operating system.

$ ls /

You will commonly see directories such as /bin, /boot, /dev, /etc, /home, /lib, /root, /run, /tmp, /usr and /var.

2. /bin — Essential User Commands

/bin traditionally contains essential executable programs required for basic system operation and recovery. Commands such as ls, cp, mv, rm and similar utilities may be provided here.

On many modern Linux distributions, /bin is a symbolic link to /usr/bin because of the usr merge.

3. /boot — Boot Files

/boot contains files required during the boot process, including the Linux kernel and bootloader-related files.

Kernel

The core Linux operating system kernel is commonly stored under this directory.

Bootloader

Bootloader configuration and supporting files can be stored here.

Be careful when modifying files in /boot; incorrect changes can prevent a machine from booting.

4. /dev — Device Files

Linux represents many hardware and virtual devices as files under /dev. Disks, terminals, pseudo-devices and other device interfaces can appear here.

$ ls /dev
$ ls /dev/sd*
$ ls /dev/null

This is part of the Unix/Linux philosophy of exposing system resources through file-like interfaces.

5. /etc — System Configuration

/etc is one of the most important directories for administrators and DevOps engineers. It contains system-wide configuration files.

/etc/hosts

Local hostname-to-IP mappings.

/etc/fstab

Defines filesystems and mount configuration.

/etc/ssh

SSH server and client configuration.

/etc/nginx

Common location for Nginx configuration on many distributions.

When troubleshooting Linux servers, /etc is often the first place to investigate configuration.

6. /home — User Home Directories

/home contains the personal directories of normal users. For example, a user named john might have a home directory at /home/john.

$ cd /home
$ ls
john developer tester

User-specific files, SSH configuration, shell history and application configuration may live inside each user's home directory.

7. /lib and /lib64 — Essential Libraries

These directories contain essential shared libraries and kernel modules needed by programs and the operating system.

As with /bin, modern distributions may merge or redirect traditional library paths into /usr/lib and related locations.

8. /root — Root User's Home

/root is the home directory of the root user. It is different from /: the first is the root user's home, while the second is the root of the entire filesystem.

Don't confuse them: / = filesystem root. /root = home directory of the root account.

9. /run — Runtime Data

/run contains runtime information created after the system boots. It commonly includes process IDs, sockets and other temporary runtime state.

Many files here are stored in memory-backed filesystems and do not persist across reboots.

10. /srv — Service Data

/srv is intended for site-specific or service-specific data. A web server or FTP service can use a directory below /srv for data it serves.

Actual usage varies by distribution and application architecture, but the directory provides a conventional place for service data.

11. /tmp — Temporary Files

/tmp is used for temporary files created by applications and users. Files here should generally be considered disposable.

$ echo "temporary data" > /tmp/example.txt
$ cat /tmp/example.txt

Do not use /tmp as permanent storage for important application data.

12. /usr — User Programs and Resources

/usr contains a large portion of user-space programs, libraries, documentation and other read-only resources on a modern Linux system.

DirectoryTypical purpose
/usr/binMost user command-line programs
/usr/sbinSystem administration programs
/usr/libLibraries and supporting files
/usr/shareArchitecture-independent data such as documentation
/usr/localLocally installed software and files

13. /var — Variable Data

/var stores data expected to change during normal system operation. This includes logs, caches, databases, queues and application state.

/var/log

System and application logs.

/var/lib

Persistent application or service state.

/var/cache

Cached application data.

/var/tmp

Temporary files intended to persist longer than typical /tmp files.

$ ls /var/log
$ sudo journalctl -xe

For DevOps troubleshooting, /var/log is especially important because service and system logs often reveal the reason for failures.

14. /mnt and /media — Mounted Filesystems

/mnt is traditionally used as a temporary mount point for filesystems mounted manually by an administrator. /media is commonly used for automatically mounted removable media.

/mnt

Temporary or administrator-managed mounts such as disks and filesystems.

/media

Common location for removable media such as USB drives and optical media.

15. Special Virtual Filesystems

Some Linux directories are not ordinary storage on disk. They expose kernel, process and hardware information through virtual filesystems.

PathPurpose
/procProcess and kernel information
/sysKernel and device information
/devDevice interfaces
/runRuntime state
$ cat /proc/cpuinfo
$ cat /proc/meminfo
$ ls /sys/class

16. Commands Every Beginner Should Know

$ pwd # show current directory
$ ls -lah # list files with details
$ cd /etc # change directory
$ find /var -type f # find files
$ du -sh /var/* # check directory sizes
$ df -h # check filesystem disk usage
$ mount # show mounted filesystems

These commands are particularly useful when investigating disk usage, configuration, permissions, mounted storage and application failures.

17. Linux Filesystem and DevOps

Understanding the filesystem is essential for DevOps work. Docker containers, web servers, databases, CI/CD agents and Linux services all interact with these paths.

Logs

Investigate /var/log when services fail or unexpected behavior occurs.

Configuration

Check /etc for service configuration and system settings.

Applications

Programs and libraries commonly live under /usr and /usr/local.

Storage

Understand mounts such as /mnt and persistent application data under /var/lib.

🧠 Remember These Paths

  • / — filesystem root
  • /bin — essential commands
  • /boot — bootloader and kernel files
  • /dev — device files
  • /etc — configuration
  • /home — normal users' home directories
  • /root — root user's home
  • /run — runtime state
  • /tmp — temporary files
  • /usr — programs and shared resources
  • /var — changing data such as logs and application state
  • /mnt / /media — mounted filesystems and removable media

Conclusion

The Linux filesystem may look complicated at first, but its structure becomes predictable once you understand the purpose of the major directories.

As a beginner, focus first on /, /etc, /home, /var, /usr, /tmp, /dev and /boot. These paths will appear constantly while managing Linux servers and DevOps infrastructure.

Once this mental model is comfortable, topics such as permissions, processes, systemd, Docker volumes, mounts, Kubernetes storage and Linux troubleshooting become much easier to understand.