Origin Academy
← Back to course

Linux Administration Phase 0 is free

Join the waitlist

Phase 0 · Module 2 of 5

Finding your way around the Linux filesystem

Navigating the filesystem hierarchy · 10 min read

On Linux there are no drive letters. Everything lives in a single tree that starts at /, the root directory, and disks, USB sticks and network shares are attached (mounted) somewhere inside it. Knowing where things live is the first skill of any administrator: when something breaks at 2 a.m., you need to know where its config, logs and data are without searching.

The directories you'll visit every day

  • /etc: configuration files, for the system and for services like SSH and nginx.
  • /var/log: logs. When something goes wrong, look here (or ask journald) first.
  • /home: users' home directories. /root is the root user's home.
  • /usr/bin and /usr/sbin: installed programs. /usr/lib: their libraries.
  • /var/lib: data that programs keep, such as databases and package state.
  • /tmp: temporary files, often cleared on reboot.
  • /proc and /sys: not real files on disk, but live views of the kernel and hardware.

Moving around

$ pwd                 # where am I?
/home/ada
$ ls -la /etc/ssh     # long listing, including hidden files
$ cd /var/log         # absolute path: starts at /
$ cd ../lib           # relative path: from where you are now
$ cd ~                # home directory (cd on its own does the same)
$ cd -                # back to the previous directory

An absolute path starts with / and means the same thing wherever you are. A relative path is interpreted from your current directory: .. is the parent and . is the current directory. Most mistakes with commands like rm come from a relative path pointing somewhere you didn't expect, which is why careful admins check pwd first.

Looking things up

$ cat /proc/cpuinfo | head      # what CPU is this?
$ ls /sys/class/net             # which network interfaces exist?
$ df -h                         # which filesystems are mounted, and how full?
$ man hier                      # the manual page for the filesystem layout itself

Try it

  • Find the configuration file for the SSH server on your machine. What directory is it in, and why there?
  • Use ls -l /proc/self to see a directory that describes the ls process itself. What happens if you run it twice?
  • Run df -h and explain each mounted filesystem in one line.

In the full course you'll use this map constantly: reading logs in /var/log and journald, hardening configs in /etc, managing disks under /dev, and finally running a whole multi-server environment through planned changes and incidents.

Next in Phase 0

Files, links, archives and compression

Continue →