Linux file system hierarchy: /, /etc, /var, /home, /tmp, /proc, /dev, /usr, /bin; file types

Linux Essentials Preparation · lesson 6 of 23 · 25 min

The FHS (Filesystem Hierarchy Standard)

Linux uses a single unified directory tree starting at / (root). All files and devices are accessible from this root. The FHS (Filesystem Hierarchy Standard) defines the purpose of each top-level directory.

File types in Linux: Regular file (-), Directory (d), Symbolic link (l), Block device (b), Character device (c), Named pipe (p), Socket (s). Shown in the first character of ls -l output.

/proc filesystem: Virtual — not on disk. Contains process information (/proc/PID/), system info (/proc/cpuinfo, /proc/meminfo), and kernel parameters (/proc/sys/).

/dev/null — discards all data written to it. /dev/zero — produces infinite null bytes. /dev/random — produces random bytes.

Exam Tip

Know the purpose of each top-level directory. /etc = config files. /var/log = log files. /proc = virtual kernel info. /tmp = cleared on reboot. /home = user directories. /boot = kernel and bootloader.

Key Terms

Key Terms

Knowledge Check — 8 Questions

Linux Essentials — Filesystem Hierarchy

System configuration files are stored in:

  • /bin
  • /etc
  • /var
  • /usr
  • Answer: /etc

/etc contains system-wide configuration files — sshd_config, passwd, fstab, hosts, resolv.conf, etc. Log files are typically stored in:

  • /tmp
  • /proc
  • /var/log
  • /etc/log
  • Answer: /var/log

/var/log contains system and application logs — auth.log, syslog, kern.log, apache2/, nginx/, etc. /proc is described as a virtual filesystem because:

  • It is encrypted
  • It is not stored on disk — it represents kernel and process data in memory
  • It is read-write only
  • It stores temporary files
  • Answer: It is not stored on disk — it represents kernel and process data in memory

/proc is generated dynamically by the kernel — reading /proc/cpuinfo gives real-time CPU info without reading a file on disk. The /tmp directory is:

  • Permanent storage for temp files
  • Cleared on reboot
  • Only accessible by root
  • Used for device files
  • Answer: Cleared on reboot

/tmp is for temporary files — cleared on reboot. Applications use it for scratch space. Do not store important data here. The kernel and bootloader files are stored in:

  • /etc
  • /boot
  • /usr
  • /lib
  • Answer: /boot

/boot contains the kernel (vmlinuz), initramfs, and GRUB bootloader files needed to start the system. Writing data to /dev/null:

  • Saves it to a null file
  • Discards it permanently
  • Sends it to /tmp
  • Encrypts it
  • Answer: Discards it permanently

/dev/null is the “black hole” — anything written to it is discarded. Used to suppress output: command 2>/dev/null. User home directories are located under:

  • /root
  • /home
  • /usr
  • /var/home
  • Answer: /home

/home contains subdirectories for each regular user (/home/alice, /home/bob). The root user’s home is /root.

The root of the Linux filesystem is represented by a single _____ character.

Answer: /
The Linux filesystem starts at / (forward slash) — the root directory. All other directories are subdirectories of /.


Previous lesson: Command line basics: shell, terminal, pwd, ls, cd, man, history, tab completion, I/O redirection, pipes
Back to Linux Essentials Preparation
Next lesson: Navigating the filesystem: absolute vs relative paths, ls options, hidden files, file types