LESSON · 1 OF 6

The Linux filesystem tree

The Linux filesystem tree

Every file and folder on a Linux machine lives inside one tree. The tree has exactly one root, written /. No C:, no D:, no separate drives.

/
├── etc/       # system-wide configuration
├── var/       # variable data: logs, spools, caches
├── home/      # regular users' home folders
├── root/      # the root user's home
├── tmp/       # temporary files, often wiped on reboot
├── usr/       # installed software
└── bin/       # essential command binaries

These are the most common folders that you would see directly under /. Each one has a specific job.

  • /etc holds system-wide configuration.
  • /var holds data that changes while the system runs, like logs, mail queues, and package caches. The one you'll open most is /var/log, which is where every service writes its log files.
  • /home holds one folder per regular user account. A user named alice gets /home/alice as her home folder, and she typically owns everything inside it.
  • /root is the home folder of the root (administrator) user. It's kept separate from /home so the root account can still work even if /home is on a broken disk.
  • /tmp is scratch space. Any process can write files here, and the contents are typically wiped on reboot. Never store anything you want to keep.
  • /usr holds installed software: user programs in /usr/bin, libraries in /usr/lib, documentation in /usr/share. Package managers put most of their files here.
  • /bin holds essential command binaries needed early during boot and system recovery, like ls, cp, and bash. On modern Linux it's usually a symlink to /usr/bin.

The others exist too (/dev, /proc, /sys, /opt, /srv, /mnt, /media), and you'll meet them as they come up.

Where you are in the tree

You met pwd in the previous topic. Run it now and you'll see where in this tree the shell has placed you (probably /root, the root user's home). Every path you write is either an address starting from / (the top of this tree) or a shortcut from wherever pwd currently reports. The next node covers those two styles in detail.

Spin up a fresh environment and practice live.
linux-devops-basic · fresh machine · ready in under a minute