SyntaxStudy
Sign Up
Linux / Bash Understanding the Linux Filesystem Hierarchy
Linux / Bash Beginner 1 min read

Understanding the Linux Filesystem Hierarchy

Linux organises all files in a single unified directory tree that starts at the root `/`. Unlike Windows, which uses separate drive letters, every storage device and network share is mounted somewhere within this single tree. Understanding the filesystem hierarchy standard (FHS) tells you where to find programs, configuration files, logs, and user data. Key directories include `/bin` and `/usr/bin` for user-executable programs, `/etc` for system-wide configuration files, `/home` for user home directories, `/var` for variable data like logs and databases, `/tmp` for temporary files, and `/proc` and `/sys` for virtual filesystems that expose kernel and hardware information at runtime. Absolute paths begin from the root `/` and fully specify a file location regardless of your current position. Relative paths are expressed relative to your current directory. The special entries `.` (dot) and `..` (dot-dot) refer to the current directory and the parent directory respectively. Tilde `~` is shorthand for your home directory.
Example
# Print the current working directory
pwd
# /home/alice

# List key top-level directories
ls /
# bin  boot  dev  etc  home  lib  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

# Show disk usage of top-level dirs, sorted
du -sh /* 2>/dev/null | sort -h

# Navigate using absolute path
cd /etc/nginx

# Navigate using relative path
cd ../apache2

# Go to home directory (three equivalent ways)
cd
cd ~
cd $HOME

# Go to the previous directory
cd -

# Explore /proc virtual filesystem
cat /proc/cpuinfo | head -20
cat /proc/meminfo
cat /proc/version
ls /proc/$$/         # Current shell's process info

# Show filesystem mount points
mount | column -t
lsblk                # Block devices and mount points