| |

LFCA 9 ๐Ÿง The Linux Filesystem Hierarchy

Linux organizes every file into a single tree โ€” one root, many branches, no drive letters. The Filesystem Hierarchy Standard (FHS) defines what lives where: /etc for configuration, /home for user data, /var for variable data, /usr for programs, /tmp for temporary files. Every Linux distribution follows this standard, so once you know the layout, you can navigate any system. The LFCA exam expects you to know the major directories, what each is for, and how they differ from Windows-style drive letters.

Key point: Linux has one filesystem tree rooted at /. Everything โ€” including additional disks โ€” is mounted somewhere under that tree. There are no drive letters like C: or D:. The FHS defines the standard directories and their purposes. Knowing where to look for what โ€” configuration, logs, binaries, user data โ€” is the foundation of every Linux task.


The single tree

In Linux, every file and directory lives under / โ€” the root directory. That’s different from Windows, where each drive has its own letter.

Windows vs Linux:

WindowsLinux
C:\/
C:\Users\Alice/home/alice
C:\Windows\System32/usr/bin, /usr/lib
D:\ (second drive)Mounted at /mnt/data or similar
E:\ (USB)Mounted at /media/user/USB

How additional disks work:

A second physical disk doesn’t get a new letter. Instead, it’s mounted at a directory in the tree.

# Mount a disk at /mnt/data
sudo mount /dev/sdb1 /mnt/data

# Now /mnt/data is the disk
ls /mnt/data

The disk’s contents appear at /mnt/data. The rest of the tree is unaffected.

Why this design: Everything is a path. A program reads /etc/config, writes /var/log/output, stores user data in /home/alice, regardless of which physical disk holds it. Mounting is transparent โ€” paths just work.

Mounting at boot: The /etc/fstab file lists what to mount and where. Each line: device, mount point, filesystem type, options.

/dev/sdb1   /mnt/data   ext4   defaults   0 2

At boot, the kernel reads this and mounts everything automatically.

Why “everything is a file”: In Linux, devices, sockets, pipes, and regular files all appear in the filesystem. /dev/sda is the first disk. /proc/cpuinfo shows CPU info. This uniform interface is one of Linux’s foundational ideas โ€” programs interact with hardware and system state through the same read/write model as regular files.


The FHS โ€” purpose of each directory

The Filesystem Hierarchy Standard defines each top-level directory’s purpose. Every distribution follows it.

DirectoryPurpose
/Root of the tree
/binEssential user binaries (commands)
/sbinSystem binaries (admin commands)
/etcSystem configuration files
/homeUser home directories
/rootRoot user’s home
/varVariable data (logs, spools, caches)
/tmpTemporary files
/usrUser-installed programs and libraries
/optOptional add-on software
/libShared libraries for binaries
/bootKernel and bootloader files
/devDevice files
/procKernel and process info (virtual)
/sysKernel and hardware info (virtual)
/mntTemporary mount point for admins
/mediaRemovable media mount point
/srvService data (web, ftp, etc.)
/runRuntime data (since boot)

These aren’t arbitrary. Each has a specific role. /etc for config, /var for data that changes, /usr for user-space programs, /dev for devices. Once you know the pattern, you know where to find almost anything.

Why the standard matters: A sysadmin on any distro knows where to look. Web server configs are in /etc/nginx or /etc/apache2. Logs are in /var/log. User files are in /home. The path is predictable, so skills transfer between systems.

Modern merges: On many distros, /bin, /sbin, and /lib are symlinks into /usr/bin, /usr/sbin, and /usr/lib. This is called usr-merge โ€” it simplifies the layout without changing the standard paths.

ls -l /bin
# lrwxrwxrwx 1 root root 7 ... /bin -> usr/bin

Either path works. The FHS still documents both.

Why the FHS exists: Early Unix systems organized files differently. The FHS standardized the layout so software could rely on paths. A package’s config goes in /etc, its logs in /var/log, its binary in /usr/bin. Without the standard, every distro would invent its own layout, and no software would be portable.


/ โ€” the root

The root directory is the top of the tree. Everything else is below it.

ls /
# bin  boot  dev  etc  home  lib  media  mnt
# opt  proc  root  run  sbin  srv  sys  tmp  usr  var

Every other directory is a child of /. Paths can be absolute (starting with /) or relative (starting from the current directory).

Absolute paths:

cd /etc/nginx
cat /var/log/syslog
ls /home/alice/Documents

Start with / โ€” always from the root.

Relative paths:

cd nginx              # from current dir
cat ../config
./script.sh

No leading / โ€” relative to where you are.

Special path symbols:

SymbolMeaning
/Root
.Current directory
..Parent directory
~Home directory
~aliceAlice’s home

Why the root is unique: It can’t be renamed, moved, or removed. Everything depends on it. If / is corrupted, the system won’t boot.

Why absolute vs relative matters: Absolute paths work from anywhere; relative paths depend on where you are. Scripts use absolute paths for predictability. Interactive shells often use relative paths for brevity.


/bin and /sbin โ€” essential binaries

/bin holds essential user commands; /sbin holds system administration commands.

/bin examples:

  • ls, cp, mv, rm
  • cat, grep, sed, awk
  • bash, sh
  • mkdir, rmdir, touch

/sbin examples:

  • fdisk, mkfs, fsck
  • iptables, ip
  • reboot, shutdown
  • mount, umount

What “essential” means: Available even when the system is booting or in recovery mode, before /usr is mounted. Modern distros with usr-merge often have /bin and /sbin as symlinks to /usr/bin and /usr/sbin, but the paths still work.

Modern conventions:

  • User commands โ†’ /usr/bin
  • System commands โ†’ /usr/sbin
  • Local administrator commands โ†’ /usr/local/bin or /usr/local/sbin

Why the split: Historically, /bin was for everyone; /sbin was for root. In practice, non-root users can run many /sbin commands if they have permission. The split is about purpose more than access control now.

Why the distinction: A normal user needs ls and cp. A sysadmin needs fdisk and mkfs. Keeping admin tools in /sbin signals “these require root or advanced knowledge.” Both are in the $PATH for root, so commands work either way.


/etc โ€” configuration

/etc holds system-wide configuration files. Everything that configures software lives here โ€” usually as plain text.

Common files:

PathPurpose
/etc/passwdUser accounts
/etc/shadowPassword hashes (root only)
/etc/groupGroups
/etc/hostsLocal hostname resolution
/etc/resolv.confDNS servers
/etc/fstabFilesystem mounts at boot
/etc/ssh/sshd_configSSH server config
/etc/nginx/nginx.confNginx config
/etc/apt/APT package manager config
/etc/netplan/Network config (Ubuntu)
/etc/systemd/systemd config

Conventions:

  • Text files. Editable with any editor.
  • Comments start with #.
  • Subdirectories group related configs (/etc/nginx/, /etc/ssh/).
  • .d directories hold drop-in config fragments (/etc/apt/apt.conf.d/).
  • .conf files are usually the main config.

Common pattern:

/etc/program/
โ”œโ”€โ”€ program.conf         โ† main config
โ”œโ”€โ”€ conf.d/              โ† drop-ins
โ”‚   โ”œโ”€โ”€ 10-base.conf
โ”‚   โ””โ”€โ”€ 20-custom.conf
โ””โ”€โ”€ snippets/            โ† reusable parts

The .d convention lets packages drop config files without editing the main config.

Backups: /etc is the most important directory to back up. It contains everything that makes the system this specific system โ€” users, network, services, apps. Copying /etc to another machine reproduces the configuration.

Why /etc is critical: Configuration defines behavior. A broken config file can prevent a service from starting, lock out users, or make the network unreachable. /etc is where admins spend most of their time.

Why “etc” for config: The name stands for “et cetera” โ€” it was originally a catch-all directory for things that didn’t belong elsewhere. Over time, it became the standard place for configuration. Modern usage is unambiguous: system config goes in /etc.


/home and /root โ€” user directories

Home directories hold each user’s personal files, settings, and documents.

User home directories:

/home/alice/
โ”œโ”€โ”€ Documents/
โ”œโ”€โ”€ Downloads/
โ”œโ”€โ”€ Pictures/
โ”œโ”€โ”€ .bashrc              โ† shell config
โ”œโ”€โ”€ .config/             โ† app configs
โ””โ”€โ”€ .ssh/                โ† SSH keys

Each user gets their own /home/USERNAME directory, created when the account is added. It’s their space โ€” files, preferences, SSH keys, and application data.

Dot files: Hidden files starting with . hold user-specific config. .bashrc, .zshrc, .gitconfig, .vimrc. They’re user-level equivalents of /etc โ€” config for that user’s tools.

Root’s home: The root user’s home is /root, not /home/root. This is deliberate โ€” root’s home is available even if /home isn’t mounted.

sudo ls /root
# contents of root's home

Permissions: Each user owns their own /home/USERNAME and can’t access others’ by default.

ls -l /home
# drwxr-xr-x 2 alice alice 4096 ... alice
# drwxr-xr-x 2 bob   bob   4096 ... bob

Only the user (and root) can read/write inside.

Why home directories matter: They’re where user data lives. Backups, migrations, and account management all focus on /home. Losing /home is losing user data; losing everything else is a reinstall.

Why /root isn’t under /home: Root’s home needs to be available even when /home is on a separate partition that isn’t mounted, or during recovery when /home might be corrupted. Keeping it at /root guarantees root can always log in with their config.


/var โ€” variable data

/var holds data that changes while the system runs โ€” logs, caches, spools, databases.

Common subdirectories:

PathPurpose
/var/log/System and application logs
/var/cache/Application caches
/var/spool/Print, mail, cron queues
/var/tmp/Temporary files that survive reboot
/var/lib/State data (databases, package info)
/var/www/Web content (some setups)
/var/run/ โ†’ /runRuntime data (symlink on modern systems)

Key files:

/var/log/syslog            โ† general system log
/var/log/auth.log          โ† authentication events
/var/log/kern.log          โ† kernel messages
/var/log/dpkg.log          โ† package operations
/var/log/nginx/            โ† web server logs
/var/lib/mysql/            โ† MySQL data
/var/lib/docker/           โ† Docker data

Why /var is separate: Logs grow. Caches fill disks. Spools accumulate. Keeping /var on its own partition prevents these from filling / and crashing the system. On servers, /var often has its own volume.

Managing /var:

# Check size
du -sh /var/log

# Rotate logs (via logrotate)
sudo logrotate -f /etc/logrotate.conf

# Clean cache
sudo apt clean

Why the exam tests /var: It’s where logs live. Knowing /var/log is the first step in troubleshooting any issue. Services log here by convention.

Why variable data has its own directory: Data that grows or changes shouldn’t share a partition with static system files. If /var/log fills up, you don’t want / to fill with it. The separation is a safety mechanism โ€” /var fills, the rest of the system keeps running.


/usr โ€” user programs and libraries

/usr holds user-space programs, libraries, documentation, and shared data. It’s usually the largest directory after /home.

Common subdirectories:

PathPurpose
/usr/bin/Most user commands
/usr/sbin/System commands
/usr/lib/Libraries
/usr/share/Architecture-independent data (docs, icons)
/usr/local/Locally installed software
/usr/include/C headers
/usr/src/Source code (kernels)

What’s in /usr/share/:

  • Documentation โ€” man pages, doc
  • Icons, fonts
  • Locale files
  • Application data that doesn’t depend on architecture

What’s in /usr/local/:

Software you install manually (not via the package manager) goes here:

/usr/local/bin/
/usr/local/lib/
/usr/local/etc/
/usr/local/share/

This keeps locally compiled tools separate from package-managed ones.

The /usr merge: On modern systems, /bin, /sbin, and /lib are symlinks into /usr. This unification simplifies the layout โ€” everything user-space lives under /usr.

ls -l /bin /sbin /lib
# /bin -> usr/bin
# /sbin -> usr/sbin
# /lib -> usr/lib

Why /usr matters: Most installed software lives here. When you install a package with apt or dnf, its files land in /usr/bin, /usr/lib, /usr/share. Understanding /usr means knowing where software goes.

Why /usr/local is special: Package managers own /usr/bin, /usr/lib, etc. Installing files there manually can conflict with packages. /usr/local is reserved for the admin โ€” the package manager doesn’t touch it. Manual installs go there to avoid conflicts.


/boot โ€” kernel and bootloader

/boot holds everything needed to boot the system.

Contents:

File/DirPurpose
vmlinuz-*The kernel
initrd.img-* / initramfs-*Initial RAM filesystem
grub/GRUB bootloader config
System.map-*Kernel symbol table
config-*Kernel build config

Example:

/boot/
โ”œโ”€โ”€ vmlinuz-6.8.0-45-generic
โ”œโ”€โ”€ initrd.img-6.8.0-45-generic
โ”œโ”€โ”€ config-6.8.0-45-generic
โ”œโ”€โ”€ System.map-6.8.0-45-generic
โ””โ”€โ”€ grub/
    โ””โ”€โ”€ grub.cfg

On UEFI systems, the EFI System Partition is usually mounted at /boot/efi, containing bootloaders and firmware files.

Updating the kernel: Package managers install new kernels here. GRUB is regenerated to include them in the menu. Old kernels accumulate until cleaned up.

# List installed kernels
dpkg -l | grep linux-image

# Remove old kernels
sudo apt autoremove

Why /boot can be small but critical: Kernels and initramfs files are 10โ€“100 MB each. A 500 MB /boot partition is common. Filling it prevents kernel updates.

Why /boot is a separate partition: Older systems couldn’t read large disks from the bootloader, so /boot had to be within the first few GB. That limitation is gone, but the separation persists โ€” it protects boot files from filling up with user data, and on encrypted systems, /boot stays unencrypted so the bootloader can read it.


Virtual filesystems โ€” /proc, /sys, /dev, /run

These aren’t real files on disk. They’re virtual โ€” the kernel exposes information and device access through them.

/proc โ€” process and kernel info:

cat /proc/cpuinfo       # CPU information
cat /proc/meminfo       # Memory info
cat /proc/version       # Kernel version
ls /proc/               # numeric dirs = process IDs
cat /proc/1234/cmdline  # command line of PID 1234

Each running process gets a /proc/PID directory.

/sys โ€” hardware and kernel objects:

ls /sys/class/net/      # network interfaces
cat /sys/class/thermal/thermal_zone0/temp   # temperature

/sys exposes the kernel’s device model as a tree. Used by tools and for tweaking hardware parameters.

/dev โ€” device files:

ls /dev/sd*             # disks
ls /dev/tty*            # terminals
ls /dev/null            # null device

Devices appear as files. Writing to /dev/sda writes to the disk. Reading from /dev/urandom gives random bytes.

/run โ€” runtime data since boot:

ls /run/                # PID files, sockets, locks
cat /run/sshd.pid       # PID of sshd

/run is a tmpfs โ€” stored in memory, wiped on reboot. For runtime state that shouldn’t persist.

Why virtual filesystems matter: They give uniform access to system state. A program can read hardware info from /sys, process info from /proc, and devices from /dev, all through the same file interface. No special APIs needed โ€” just read and write.

Why they look like directories: Linux treats them uniformly. The kernel implements them as filesystems โ€” procfs, sysfs, devtmpfs โ€” mounted at boot. To the shell, they behave like regular directories. To the kernel, they’re dynamic views of system state.


/tmp, /mnt, /media, /opt, /srv

Five more directories worth knowing.

/tmp โ€” temporary files:

mktemp              # create a temp file
echo "data" > /tmp/scratch

Files here are typically cleared on reboot (systemd-tmpfiles or tmpwatch). All users can write here. Don’t store anything you need to keep.

/mnt โ€” temporary mounts:

Admin-mounted filesystems. Used for temporarily mounting a disk or network share:

sudo mount /dev/sdb1 /mnt

Administrator’s scratch space for mounts.

/media โ€” removable media:

Auto-mounted USB drives, DVDs, external disks. The desktop environment mounts them here:

/media/alice/USB_DRIVE/
/media/alice/CD-ROM/

/opt โ€” optional software:

Third-party applications installed as a self-contained package:

/opt/google/chrome/
/opt/spotify/

Each app gets its own subdirectory. Used by software that doesn’t fit the FHS layout of /usr.

/srv โ€” service data:

Data served by the system โ€” web roots, FTP directories, git repos. Often unused on modern systems, but historically:

/srv/www/
/srv/ftp/
/srv/git/

Web content often lives in /var/www instead, but /srv is the FHS-correct place.

Why these exist: Each handles a specific kind of ephemeral, external, or service-specific data. /tmp for scratch, /mnt for admin mounts, /media for users, /opt for third-party apps, /srv for service data.

Why /tmp is world-writable: Every process might need a scratch file. Restricting it to root would break many tools. The convention is that /tmp is shared, cleaned at boot, and never trusted for anything important. Symlink attacks are why /tmp is often mounted with noexec or nosuid.


A full example

Exploring the filesystem hierarchy on a real system.

# ============================================
# PART 1: TOP-LEVEL STRUCTURE
# ============================================

ls -F /
# [ bin@  boot/  dev/  etc/  home/  lib@  media/  mnt/ ]
# [ opt/  proc/  root/  run/  sbin@  srv/  sys/  tmp/  usr/  var/ ]

# ============================================
# PART 2: /etc โ€” CONFIGURATION
# ============================================

ls /etc | head -10
# [ adduser.conf  alternatives  apt  bash.bashrc  ... ]

cat /etc/hostname
# [ myserver ]

cat /etc/hosts
# [ 127.0.0.1    localhost ]
# [ 127.0.1.1    myserver ]

# ============================================
# PART 3: /home โ€” USER DATA
# ============================================

ls /home
# [ alice ]

ls -la /home/alice | head -5
# [ drwxr-xr-x  ... . ]
# [ drwxr-xr-x  ... .. ]
# [ -rw-r--r--  ... .bashrc ]
# [ drwx------  ... .ssh ]

# ============================================
# PART 4: /var โ€” VARIABLE DATA
# ============================================

ls /var/log | head -8
# [ apt  auth.log  boot.log  dpkg.log  journal  kern.log  syslog  ... ]

sudo tail -3 /var/log/syslog
# [ recent log entries ]

# ============================================
# PART 5: /usr โ€” PROGRAMS
# ============================================

ls /usr/bin | head -5
# [ a2ps  a2p  aa-enabled  aa-exec  ab ]

which ls cat grep
# [ /usr/bin/ls ]
# [ /usr/bin/cat ]
# [ /usr/bin/grep ]

# ============================================
# PART 6: /boot โ€” KERNEL
# ============================================

ls /boot
# [ config-6.8.0-45-generic ]
# [ grub/ ]
# [ initrd.img-6.8.0-45-generic ]
# [ System.map-6.8.0-45-generic ]
# [ vmlinuz-6.8.0-45-generic ]

# ============================================
# PART 7: VIRTUAL FILESYSTEMS
# ============================================

cat /proc/version
# [ Linux version 6.8.0-45-generic ... ]

ls /sys/class/net/
# [ enp3s0  lo ]

ls /dev/sd* /dev/null
# [ /dev/sda  /dev/sda1  /dev/sda2  /dev/null ]

ls /run | head -5
# [ NetworkManager  cloud-init  lock  sshd.pid  ... ]

# ============================================
# PART 8: SPECIAL DIRECTORIES
# ============================================

ls /tmp | head -3
# [ snap-private-tmp  systemd-private-... ]

ls /opt
# [ google ]

ls /srv
# [ (empty or service data) ]

# ============================================
# PART 9: DISK USAGE BY DIRECTORY
# ============================================

sudo du -sh /* 2>/dev/null | sort -h
# [ 4.0K   /srv ]
# [ 16K    /opt ]
# [ 1.2M   /root ]
# [ 5.8M   /tmp ]
# [ 10M    /media ]
# [ 100M   /boot ]
# [ 500M   /home ]
# [ 1.5G   /var ]
# [ 5.0G   /usr ]
# [ 7.5G   / (total) ]

The exploration covers each major directory โ€” what’s in it, what it looks like, what its purpose is.

Why this exercise is the fastest way to learn: Seeing the real directories โ€” with real contents โ€” makes the FHS concrete. You see /etc/hostname, /home/alice/.bashrc, /var/log/syslog. The abstract layout becomes a working system.


Complete Example Session

# ============================================
# PART 1: EXPLORE THE ROOT
# ============================================

ls -F /
# [ bin@  boot/  dev/  etc/  home/  lib@  media/ ]
# [ mnt/  opt/  proc/  root/  run/  sbin@  srv/ ]
# [ sys/  tmp/  usr/  var/ ]

# ============================================
# PART 2: /bin, /sbin, /usr/bin
# ============================================

ls -l /bin
# [ lrwxrwxrwx ... /bin -> usr/bin ]

which ls cp mv
# [ /usr/bin/ls ]
# [ /usr/bin/cp ]
# [ /usr/bin/mv ]

which fdisk reboot
# [ /usr/sbin/fdisk ]
# [ /usr/sbin/reboot ]

# ============================================
# PART 3: /etc CONTENTS
# ============================================

ls /etc/ | wc -l
# [ 220 ]

ls /etc/ | grep -E 'passwd|group|hosts|fstab|resolv'
# [ fstab ]
# [ group ]
# [ hosts ]
# [ passwd ]
# [ resolv.conf ]

head -3 /etc/passwd
# [ root:x:0:0:root:/root:/bin/bash ]
# [ daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin ]
# [ bin:x:2:2:bin:/bin:/usr/sbin/nologin ]

# ============================================
# PART 4: /home CONTENTS
# ============================================

ls -a /home/alice | head -10
# [ .  ..  .bash_history  .bash_logout  .bashrc ]
# [ .cache  .config  .local  .profile  .ssh ]

# ============================================
# PART 5: /var LOGS
# ============================================

ls -la /var/log/ | head -10
# [ drwxrwxr-x  ... apt/ ]
# [ -rw-r-----  ... auth.log ]
# [ -rw-r-----  ... kern.log ]
# [ -rw-r-----  ... syslog ]

sudo tail -1 /var/log/syslog
# [ (recent kernel or service message) ]

# ============================================
# PART 6: /usr STRUCTURE
# ============================================

ls /usr
# [ bin  games  include  lib  libexec  local  sbin  share  src ]

ls /usr/local
# [ bin  etc  games  include  lib  man  sbin  share  src ]

ls /usr/share | head -5
# [ applications  bash-completion  ca-certificates ]
# [ dict  doc  fonts  ... ]

# ============================================
# PART 7: /boot CONTENTS
# ============================================

ls /boot/
# [ config-6.8.0-45-generic ]
# [ grub/ ]
# [ initrd.img-6.8.0-45-generic ]
# [ System.map-6.8.0-45-generic ]
# [ vmlinuz-6.8.0-45-generic ]

ls /boot/grub/
# [ fonts  gfxblacklist.txt  grub.cfg  grubenv ]
# [ i386-pc  locale  unicode.pf2  x86_64-efi ]

# ============================================
# PART 8: VIRTUAL FILESYSTEMS
# ============================================

cat /proc/cpuinfo | grep "model name" | head -1
# [ model name: AMD Ryzen 5 5600X ... ]

ls /proc/ | grep '^[0-9]' | head -3
# [ 1  ]
# [ 10 ]
# [ 100 ]

ls /sys/class/net/
# [ enp3s0  lo ]

ls /sys/class/thermal/
# [ cooling_device0  thermal_zone0  ... ]

ls /dev/sd* /dev/tty* 2>/dev/null | head -5
# [ /dev/sda ]
# [ /dev/sda1 ]
# [ /dev/sda2 ]
# [ /dev/tty ]
# [ /dev/tty0 ]

ls /run/ | head -5
# [ NetworkManager ]
# [ cloud-init ]
# [ lock ]
# [ sshd.pid ]
# [ systemd ]

# ============================================
# PART 9: OTHER DIRECTORIES
# ============================================

ls /tmp | head -3
# [ snap-private-tmp ]
# [ systemd-private-abc ]

ls /opt/
# [ google ]
# [ (empty or vendor dirs) ]

ls /srv/
# [ (usually empty) ]

ls /mnt /media
# [ /mnt: (empty) ]
# [ /media: alice ]

# ============================================
# PART 10: DISK USAGE
# ============================================

sudo du -sh /* 2>/dev/null | sort -h | tail -8
# [ 100K   /root ]
# [ 200K   /opt ]
# [ 1.2M   /run ]
# [ 5.8M   /tmp ]
# [ 100M   /boot ]
# [ 500M   /home ]
# [ 1.5G   /var ]
# [ 5.0G   /usr ]

# ============================================
# PART 11: MOUNTS
# ============================================

mount | grep -E '^/dev' | head -5
# [ /dev/sda2 on / type ext4 (rw,relatime) ]
# [ /dev/sda1 on /boot/efi type vfat (rw,relatime) ]
# [ /dev/sdb1 on /mnt/data type ext4 (rw,relatime) ]

cat /etc/fstab
# [ UUID=...  /         ext4  defaults   0 1 ]
# [ UUID=...  /boot/efi vfat  umask=0077 0 1 ]
# [ /dev/sdb1  /mnt/data ext4 defaults   0 2 ]

The session covers the whole tree โ€” root, /etc, /home, /var, /usr, /boot, virtual filesystems, special directories, disk usage, mounts, fstab.

Why this exercise: It’s the workflow a new admin runs to learn a system โ€” explore, read configs, check logs, find binaries, look at disk usage. The FHS becomes second nature once you’ve walked it on a real machine.


Quick Reference

Top-Level Directories

DirectoryPurpose
/Root of tree
/binEssential user binaries
/sbinSystem binaries
/libShared libraries
/etcConfiguration
/homeUser home directories
/rootRoot’s home
/varVariable data (logs, caches)
/tmpTemporary files
/usrUser programs
/optOptional add-on software
/bootKernel and bootloader
/devDevice files
/procProcess and kernel info
/sysHardware and kernel objects
/mntTemporary mount point
/mediaRemovable media
/srvService data
/runRuntime data

Where to Find What

NeedLocation
System config/etc
User files/home/USER
Logs/var/log
Databases/var/lib
Caches/var/cache
User commands/usr/bin
System commands/usr/sbin
Libraries/usr/lib
Docs/usr/share/doc
Locally installed/usr/local
Kernel/boot
Third-party apps/opt

Common Config Files

FilePurpose
/etc/passwdUsers
/etc/shadowPassword hashes
/etc/groupGroups
/etc/hostsStatic DNS
/etc/resolv.confDNS servers
/etc/fstabMounts at boot
/etc/hostnameHostname
/etc/sudoersSudo rules
/etc/ssh/sshd_configSSH daemon

Common Log Files

FileContains
/var/log/syslogGeneral log (Debian)
/var/log/messagesGeneral log (Red Hat)
/var/log/auth.logAuthentication
/var/log/kern.logKernel
/var/log/dpkg.logPackage operations
/var/log/nginx/Nginx logs
/var/log/journal/systemd journal

Virtual Filesystems

PathTypePurpose
/procprocfsProcesses, kernel info
/syssysfsHardware, kernel objects
/devdevtmpfsDevice files
/runtmpfsRuntime state

Special Path Symbols

SymbolMeaning
/Root
.Current dir
..Parent dir
~Home
~userUser’s home
-Previous dir (cd)

/var Subdirectories

PathPurpose
log/Logs
cache/Caches
lib/State data
spool/Queues
tmp/Persistent temp
run/โ†’ /run

/usr Subdirectories

PathPurpose
bin/User commands
sbin/System commands
lib/Libraries
share/Data, docs
local/Local installs
include/Headers
src/Source code

Mount Commands

CommandPurpose
mountList mounts
mount DEV DIRMount device
umount DIRUnmount
df -hDisk usage
lsblkBlock devices
cat /etc/fstabBoot mounts

Disk Usage

CommandPurpose
df -hFilesystem usage
du -sh DIRDirectory size
du -sh /*Top-level usage

Navigation

CommandPurpose
pwdCurrent directory
cd PATHChange directory
cd ~Home
cd -Previous directory
ls -laDetailed listing
treeTree view

Usr-Merge

OriginalSymlink to
/bin/usr/bin
/sbin/usr/sbin
/lib/usr/lib
/lib64/usr/lib64

Windows vs Linux

WindowsLinux
C:\/
C:\Users\USER/home/USER
C:\Windows/usr, /etc
D:\Mounted somewhere
%TEMP%/tmp

Common Directories by Purpose

PurposeDirectories
Programs/usr/bin, /usr/sbin
Config/etc
User data/home, /root
Logs/var/log
State/var/lib
Cache/var/cache
Temp/tmp, /var/tmp
Kernel/boot
Devices/dev
System info/proc, /sys

Best Practices

โœ… Do This:

# Use absolute paths in scripts
cat /etc/hostname                                     # โœ…

# Back up /etc and /home
sudo tar czf backup.tar.gz /etc /home                 # โœ…

# Check /var/log when troubleshooting
sudo tail -f /var/log/syslog                          # โœ…

# Read configs from /etc before changing
cat /etc/ssh/sshd_config                              # โœ…

# Use /usr/local for manual installs
sudo cp mytool /usr/local/bin/                        # โœ…

# Check disk usage regularly
df -h; du -sh /var/log/*                              # โœ…

# Put data on a separate mount
# Mount extra disks under /mnt, /srv, or /data          # โœ…

# Use /tmp for temporary files
mktemp                                                # โœ…

# Clean /var/cache when low on disk
sudo apt clean                                        # โœ…

# Verify after edits to /etc
# Test with -t or --check where available              # โœ…

โŒ Don’t Do This:

# Don't store important data in /tmp
cp important.txt /tmp/  # cleared on reboot             # โŒ

# Don't edit /etc/passwd directly
sudo vim /etc/passwd  # use usermod/adduser            # โŒ

# Don't install to /usr/bin manually
sudo cp mytool /usr/bin/  # packages own this         # โš ๏ธ

# Don't fill /var with logs
# Configure logrotate                                   # โŒ

# Don't delete files in /proc, /sys, /dev
rm /proc/something  # never do this                    # โŒ

# Don't ignore /var/lib
# Databases live here โ€” back them up                    # โŒ

# Don't assume Windows paths
C:\Users  # that's Windows, not Linux                  # โŒ

# Don't put service data in /home
# Use /srv or /var/www per convention                   # โš ๏ธ

# Don't store user files as root
# Root's home is /root, not /home/root                  # โŒ

# Don't use drive letters
# Linux has no C: or D: โ€” everything is under /        # โŒ

Common Pitfalls

PitfallProblemSolution
Expecting drive lettersLinux uses /Learn the tree
Storing data in /tmpCleared on rebootUse /home
Editing /etc/passwdAccount corruptionUse usermod, adduser
Filling /varLogs overflowConfigure logrotate
Forgetting /etc backupCan’t reproduceBack up /etc
Manual install to /usr/binPackage conflictsUse /usr/local/bin
Deleting /proc filesKernel corruptionDon’t โ€” virtual
Assuming /home/rootDoesn’t existRoot’s home is /root
Confusing /mnt and /mediaDifferent purposes/mnt admin, /media auto
Ignoring /var/libLose stateBack it up

Real-World Examples

1. Find the hostname

cat /etc/hostname

2. Find your user

grep $USER /etc/passwd

3. Read the DNS config

cat /etc/resolv.conf

4. Check mounts

cat /etc/fstab

5. List your home

ls -la ~

6. Read system logs

sudo tail -f /var/log/syslog

7. Check authentication logs

sudo tail /var/log/auth.log

8. Locate a command

which python3

9. Find all binaries of a package

dpkg -L nginx | grep bin

10. Check kernel files

ls /boot/

11. Read the kernel version

cat /proc/version

12. Check memory info

cat /proc/meminfo

13. List devices

ls /dev/sd*

14. Check network interfaces (virtual)

ls /sys/class/net/

15. List third-party apps

ls /opt/

16. Check disk usage

df -h

17. Directory sizes

sudo du -sh /* 2>/dev/null | sort -h

18. Mount a USB

sudo mount /dev/sdb1 /mnt

19. Check /usr/local

ls /usr/local/bin/

20. Find log files

ls /var/log/

Visual: The Filesystem Tree

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  /                                           โ”‚
โ”‚  โ”œโ”€โ”€ bin/           essential user binaries  โ”‚
โ”‚  โ”œโ”€โ”€ boot/          kernel and bootloader    โ”‚
โ”‚  โ”œโ”€โ”€ dev/           device files             โ”‚
โ”‚  โ”œโ”€โ”€ etc/           configuration            โ”‚
โ”‚  โ”œโ”€โ”€ home/          user home directories    โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ alice/                              โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ bob/                                โ”‚
โ”‚  โ”œโ”€โ”€ lib/           shared libraries         โ”‚
โ”‚  โ”œโ”€โ”€ media/         removable media          โ”‚
โ”‚  โ”œโ”€โ”€ mnt/           temporary mounts         โ”‚
โ”‚  โ”œโ”€โ”€ opt/           optional software        โ”‚
โ”‚  โ”œโ”€โ”€ proc/          process info (virtual)   โ”‚
โ”‚  โ”œโ”€โ”€ root/          root's home              โ”‚
โ”‚  โ”œโ”€โ”€ run/           runtime data             โ”‚
โ”‚  โ”œโ”€โ”€ sbin/          system binaries          โ”‚
โ”‚  โ”œโ”€โ”€ srv/           service data             โ”‚
โ”‚  โ”œโ”€โ”€ sys/           hardware (virtual)       โ”‚
โ”‚  โ”œโ”€โ”€ tmp/           temporary files          โ”‚
โ”‚  โ”œโ”€โ”€ usr/           user programs            โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ bin/                                โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ lib/                                โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ local/                              โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ sbin/                               โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ share/                              โ”‚
โ”‚  โ””โ”€โ”€ var/           variable data            โ”‚
โ”‚      โ”œโ”€โ”€ cache/                              โ”‚
โ”‚      โ”œโ”€โ”€ lib/                                โ”‚
โ”‚      โ”œโ”€โ”€ log/                                โ”‚
โ”‚      โ””โ”€โ”€ spool/                              โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Where Files Go

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Config       โ†’  /etc                        โ”‚
โ”‚  User data    โ†’  /home/USER                  โ”‚
โ”‚  Logs         โ†’  /var/log                    โ”‚
โ”‚  Binaries     โ†’  /usr/bin, /usr/sbin         โ”‚
โ”‚  Libraries    โ†’  /usr/lib                    โ”‚
โ”‚  Kernel       โ†’  /boot                       โ”‚
โ”‚  Devices      โ†’  /dev                        โ”‚
โ”‚  Temp         โ†’  /tmp                        โ”‚
โ”‚  Third-party  โ†’  /opt                        โ”‚
โ”‚  Service data โ†’  /srv                        โ”‚
โ”‚  System info  โ†’  /proc, /sys                 โ”‚
โ”‚  Runtime      โ†’  /run                        โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Real Files vs Virtual

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Real files on disk                          โ”‚
โ”‚                                              โ”‚
โ”‚  /   /etc   /home   /usr   /var   /boot      โ”‚
โ”‚                                              โ”‚
โ”‚  Persist across reboots                      โ”‚
โ”‚  Backed up                                   โ”‚
โ”‚  Have disk space                             โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Virtual filesystems                         โ”‚
โ”‚                                              โ”‚
โ”‚  /proc  /sys  /dev  /run                     โ”‚
โ”‚                                              โ”‚
โ”‚  Generated by kernel                         โ”‚
โ”‚  Not backed up                               โ”‚
โ”‚  Reflect system state                        โ”‚
โ”‚  Cleaned on reboot                           โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Mounting a Disk

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Before mount                                โ”‚
โ”‚                                              โ”‚
โ”‚  / (sda1)                                    โ”‚
โ”‚  โ”œโ”€โ”€ home/                                   โ”‚
โ”‚  โ”œโ”€โ”€ etc/                                    โ”‚
โ”‚  โ””โ”€โ”€ mnt/    โ† empty                         โ”‚
โ”‚                                              โ”‚
โ”‚  sdb1  (not accessible)                      โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ”‚
                  โ”‚  mount /dev/sdb1 /mnt
                  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  After mount                                 โ”‚
โ”‚                                              โ”‚
โ”‚  / (sda1)                                    โ”‚
โ”‚  โ”œโ”€โ”€ home/                                   โ”‚
โ”‚  โ”œโ”€โ”€ etc/                                    โ”‚
โ”‚  โ””โ”€โ”€ mnt/    โ† now shows sdb1's contents     โ”‚
โ”‚      โ”œโ”€โ”€ data/                               โ”‚
โ”‚      โ””โ”€โ”€ backups/                            โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Linux vs Windows

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Windows                                     โ”‚
โ”‚                                              โ”‚
โ”‚  C:\                                         โ”‚
โ”‚  โ”œโ”€โ”€ Users\                                  โ”‚
โ”‚  โ”œโ”€โ”€ Program Files\                          โ”‚
โ”‚  โ””โ”€โ”€ Windows\                                โ”‚
โ”‚                                              โ”‚
โ”‚  D:\  โ† separate drive with letter           โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Linux                                       โ”‚
โ”‚                                              โ”‚
โ”‚  /                                           โ”‚
โ”‚  โ”œโ”€โ”€ home/                                   โ”‚
โ”‚  โ”œโ”€โ”€ usr/                                    โ”‚
โ”‚  โ”œโ”€โ”€ etc/                                    โ”‚
โ”‚  โ””โ”€โ”€ mnt/                                    โ”‚
โ”‚      โ””โ”€โ”€ data/  โ† second disk mounted here   โ”‚
โ”‚                                              โ”‚
โ”‚  No drive letters โ€” one tree                 โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: /etc Structure

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  /etc/                                       โ”‚
โ”‚  โ”œโ”€โ”€ passwd                 users            โ”‚
โ”‚  โ”œโ”€โ”€ shadow                 passwords        โ”‚
โ”‚  โ”œโ”€โ”€ group                  groups           โ”‚
โ”‚  โ”œโ”€โ”€ hosts                  static DNS       โ”‚
โ”‚  โ”œโ”€โ”€ fstab                  mounts at boot   โ”‚
โ”‚  โ”œโ”€โ”€ hostname               machine name     โ”‚
โ”‚  โ”œโ”€โ”€ ssh/                   SSH config       โ”‚
โ”‚  โ”œโ”€โ”€ nginx/                 web server       โ”‚
โ”‚  โ”œโ”€โ”€ systemd/               init system      โ”‚
โ”‚  โ”œโ”€โ”€ apt/                   package manager  โ”‚
โ”‚  โ””โ”€โ”€ netplan/               network          โ”‚
โ”‚                                              โ”‚
โ”‚  Every package that needs config            โ”‚
โ”‚  puts it under /etc                          โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: /var Layout

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  /var/                                       โ”‚
โ”‚  โ”œโ”€โ”€ log/         logs                       โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ syslog                              โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ auth.log                            โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ nginx/                              โ”‚
โ”‚  โ”œโ”€โ”€ cache/       caches                     โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ apt/                                โ”‚
โ”‚  โ”œโ”€โ”€ lib/         state data                 โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ mysql/                              โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ docker/                             โ”‚
โ”‚  โ”œโ”€โ”€ spool/       queues                     โ”‚
โ”‚  โ”‚   โ”œโ”€โ”€ cron/                               โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ mail/                               โ”‚
โ”‚  โ””โ”€โ”€ tmp/         persistent temp            โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Disk Usage by Directory (Typical Server)

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  /usr   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 5.0G            โ”‚
โ”‚  /var   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 1.5G                          โ”‚
โ”‚  /home  โ–ˆโ–ˆ 500M                              โ”‚
โ”‚  /boot  โ–ˆ 100M                               โ”‚
โ”‚  /tmp   โ– 5.8M                               โ”‚
โ”‚  /etc   โ– 10M                                โ”‚
โ”‚  /root  โ– 1.2M                               โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: Path Symbols

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  /         absolute root                     โ”‚
โ”‚  .         current directory                 โ”‚
โ”‚  ..        parent directory                  โ”‚
โ”‚  ~         home directory                    โ”‚
โ”‚  ~alice    alice's home                      โ”‚
โ”‚  -         previous directory (cd -)         โ”‚
โ”‚                                              โ”‚
โ”‚  /etc/nginx/nginx.conf    absolute           โ”‚
โ”‚  nginx.conf               relative           โ”‚
โ”‚  ./script.sh              relative to cwd    โ”‚
โ”‚  ../config                parent dir         โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Visual: FHS Categories

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Static          Config   โ†’  /etc            โ”‚
โ”‚  data            Binaries โ†’  /usr/bin        โ”‚
โ”‚                  Kernel   โ†’  /boot           โ”‚
โ”‚                                              โ”‚
โ”‚  Variable        Logs     โ†’  /var/log        โ”‚
โ”‚  data            State    โ†’  /var/lib        โ”‚
โ”‚                  Cache    โ†’  /var/cache      โ”‚
โ”‚                                              โ”‚
โ”‚  Runtime         /proc, /sys, /run, /dev     โ”‚
โ”‚  (virtual)                                   โ”‚
โ”‚                                              โ”‚
โ”‚  Users           Homes    โ†’  /home           โ”‚
โ”‚                  Root     โ†’  /root           โ”‚
โ”‚                                              โ”‚
โ”‚  Temporary       /tmp, /var/tmp              โ”‚
โ”‚                                              โ”‚
โ”‚  External        /mnt, /media                โ”‚
โ”‚                                              โ”‚
โ”‚  Third-party     /opt, /usr/local            โ”‚
โ”‚                                              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

DirectoryPurpose
/Root of the filesystem tree
/binEssential user binaries
/sbinSystem binaries
/etcSystem configuration
/homeUser home directories
/rootRoot’s home
/varVariable data โ€” logs, caches, state
/tmpTemporary files
/usrUser programs and libraries
/optOptional third-party software
/bootKernel and bootloader
/devDevice files
/procProcess and kernel info
/sysHardware and kernel objects
/mntTemporary mount point
/mediaRemovable media
/srvService data
/runRuntime data

Key takeaways:

  • Linux has one filesystem tree rooted at / โ€” no drive letters
  • Additional disks are mounted somewhere under the tree
  • The FHS defines what lives where โ€” every distribution follows it
  • /etc holds configuration โ€” the most important directory to back up
  • /home holds user data โ€” separate from the system
  • /var holds variable data โ€” logs, caches, state
  • /usr holds programs and libraries โ€” the bulk of installed software
  • /boot holds the kernel and bootloader
  • /proc, /sys, /dev, /run are virtual โ€” generated by the kernel
  • /tmp is temporary โ€” cleared on reboot
  • /mnt and /media are for external mounts
  • /opt and /usr/local are for third-party and manual installs
  • Path symbols โ€” ., .., ~, - โ€” make navigation faster
  • Everything is a file โ€” devices, processes, and hardware all appear in the tree

Remember: The Linux filesystem isn’t arbitrary. Every directory has a purpose defined by the FHS, and every distribution follows it. Once you know where things live โ€” configs in /etc, logs in /var/log, programs in /usr, user data in /home โ€” you can navigate any Linux system. The single tree with no drive letters is one of Linux’s most distinctive features, and the standard layout is one of its most important conventions.


Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!