Archive · Linux

Where Things Live: The Linux Filesystem Hierarchy

A map of the directories you meet on every Linux server, and what belongs in each.

1 min read

  • Ubuntu 18.04.2 LTS
  • Linux kernel 4.15
  • CentOS 7.6

Linux has one directory tree, starting at /. Disks, USB sticks and network shares are mounted into that tree rather than getting drive letters. On Ubuntu 18.04.2 LTS and CentOS 7.6 the layout follows the Filesystem Hierarchy Standard, so the same map works on both.

flowchart TB
  R[Root slash] --> E[etc<br/>configuration]
  R --> V[var<br/>logs and spool]
  R --> U[usr<br/>programs and libraries]
  R --> H[home<br/>user files]
  R --> P[proc and sys<br/>kernel views]
  R --> T[tmp<br/>temporary files]
Directory Holds
/etc System-wide configuration files, all plain text
/var/log Logs such as syslog, auth.log and messages
/usr/bin, /usr/sbin Installed commands (/bin and /sbin hold the essential commands on 18.04)
/home, /root User data and the root user’s home
/proc, /sys Live kernel and hardware information, not real files
/opt Self-contained third-party software

Try ls / and cat /proc/cpuinfo. Knowing where configuration (/etc) and logs (/var/log) live answers most first questions on an unfamiliar server.