LearnLinux FoundationsImportant Files and Paths

The Filesystem Hierarchy

ls - a hands-on Linux lab on a real virtual machine.

The standard map of top-level directories on every Linux system. Read the root with ls /, learn what each floor is for (/etc for settings, /var/log for logs, /home, /bin, /boot), and prove they are directories with ls -l /. Structure-only: the top-level names are stable, but your machine may show a few different entries, so the drills teach the map and the moves.

You have learned to move around: cd into folders, ls to see what is inside, pwd to know where you are. But every folder you have visited sits somewhere inside one giant tree. And that tree is not random. It has a top. It has a fixed set of rooms with fixed jobs, the same on nearly every Linux machine on Earth.

That fixed layout has a name: the Filesystem Hierarchy Standard, or FHS. It is why an engineer can sit down at a brand-new Linux server and instantly find their way. They know where the configuration lives, where the logs pile up, and where the programs are kept. This lesson hands you that map.

The black boxes in this lesson are a practice terminal: a safe sandbox that only checks the one command each step teaches, so you cannot break anything. The listings shown are one real capture from a typical Debian machine. The top-level names are nearly identical on every Linux system, but your machine may show a few extra or missing entries depending on its distribution. That is expected, and the lesson points it out where it matters.

Picture the whole system as one tall building. There is a single ground floor that everything else is built on top of. In Linux, that ground floor is written as a single forward slash, /, and it is called the root of the filesystem. Do not confuse it with the root user (the administrator account); here / means the very bottom of the directory tree, the floor every other folder stands on.

Off that root floor there is a fixed set of top-level directories, and each one has a job. /etc holds configuration. /home holds people's personal folders. /var holds data that grows, like logs. Learn the building's floor plan once and you never get lost in it again, on any Linux machine.

The whole point of this lesson is to see that floor plan with your own eyes. The command that lists what is inside a directory is ls, which you already know. Point it at the root of everything, /, and read back the top-level directories. Run it now:

ls /

prompt: student@linuxcamp:~$ answer: ls / output: bin boot dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var hint: Type ls, a space, then a single forward slash for the root of the tree: ls /

There it is: the top floor of the whole system. Those short names, bin, etc, home, var, and the rest, are the standard top-level directories the FHS defines. Every one of them is a directory, and each holds a specific kind of thing. You will not memorise all of them today, but you will learn the handful an engineer reaches for every single day. The exact set your machine prints may vary by a name or two between distributions, which is normal and something this lesson will name explicitly.

Think of each top-level directory as a labelled floor of the building. Here are the ones you will use constantly, one line each:

Do not try to swallow the table whole. The two names to burn in first are /etc (where every configuration file lives) and /var/log (where every log file piles up). Those two answer the majority of real questions you will ever ask a Linux box.

A quick memory hook: etc sounds like "et cetera", the settings and everything-else of the system. var is short for "variable", the stuff that keeps changing while the machine runs. The names are abbreviations, and once you know what each stands for they stop looking cryptic.

The other top-level names round out the map. You will not touch some of these for a while, but you should recognise them when you see them:

/proc and /sys are not real folders on a disk. They are windows the kernel opens so you can read the machine's live state as if it were files. They get their own lessons later in this module, so a one-line mention is all you need for now.

The plain ls / gave you names, but not what KIND of thing each one is. Add the -l flag, for long listing, and ls prints one row per entry with a lot more detail. The single character you care about here is the very first one on each row. A d at the start means the entry is a directory, a folder that holds other things.

Run the long form against the root and watch that first column:

ls -l /

prompt: student@linuxcamp:~$ answer: ls -l / output: drwxr-xr-x 2 root root 4096 Jun 10 09:14 bin drwxr-xr-x 3 root root 4096 Jun 10 09:14 boot drwxr-xr-x 17 root root 3200 Jul 1 08:02 dev drwxr-xr-x 92 root root 12288 Jul 1 08:02 etc drwxr-xr-x 3 root root 4096 Jun 10 09:14 home drwxr-xr-x 14 root root 4096 Jun 10 09:14 usr drwxr-xr-x 12 root root 4096 Jul 1 08:02 var hint: Add the -l flag between ls and the slash: ls -l /

The dates, sizes, and the exact list of rows here belong to the machine this was captured on. Yours will show different timestamps, different sizes, and possibly a few more or fewer names. What is identical everywhere is the shape: every top-level entry is a directory, so every row starts with d. That leading d is the lesson, not the numbers beside it.

Every row began with d. That confirms what the FHS promises: the top level of the tree is nothing but directories, each one a labelled floor leading to more folders and files below. The rest of each row (the permissions, the owner root, the size, the date) you will decode in later lessons. For now, the win is simple: ls -l / proved these are real directories, not stray files, and that they are owned by the system.

The map only earns its keep when it answers real questions fast. Play two out.

First: a program is misbehaving and you want to read its configuration file. Configuration on Linux is text, and the FHS puts it all in one place. Which floor do you go to? You go to /etc. So you list what is inside it:

ls /etc

prompt: student@linuxcamp:~$ answer: ls /etc output: hostname hosts os-release passwd group fstab ssh systemd hint: Configuration lives in one standard directory off the root: ls /etc

The exact filenames inside /etc depend on what software the machine has installed, so your list will look different from this one. The point is not the names, it is the move: a question about configuration sends you straight to /etc every time. Several of those files, passwd, hostname, os-release, get their own lessons later in this module.

Scaffolding off. No command is printed this time. You have every piece you need.

A service has gone quiet and you want to read its log file to see what happened. You know the rule: data that grows, and logs above all, lives under one top-level directory, in the folder specifically for logs. List the contents of the directory where every log on the machine piles up.

prompt: student@linuxcamp:~$ answer: ls /var/log output: auth.log syslog kern.log dmesg apt journal hint: Logs are variable data. Think of the growing-data floor, then its log folder: /var, then /var/log.

That is the everyday reflex. Logs are variable data, so they live under /var, and the standard folder for them is /var/log. Listing it showed you the log files this machine keeps, and yours will hold a different set depending on what it runs. But the path is the same on every Linux box: when something breaks and you need the story, /var/log is where you go. You recalled that from the map alone, which is exactly the recall the real machine will ask of you.

You earned this cheat sheet. It is the working engineer's short list, the floors you will actually stand on:

And the two reflexes worth more than the whole table: a question about settings sends you to /etc, and a question about what happened sends you to /var/log. Reach those two on instinct and you can find your feet on any Linux system in the world.

The layout is a standard, not a law of nature, so distributions differ at the edges. One machine keeps programs in /bin, another makes /bin a shortcut to /usr/bin. One gives /tmp its own scratch space, another does not. The top-level names and their jobs are what stay constant, and that constancy is the whole value of the FHS.

The practice terminal has shown you the shape of the system: the root /, the top-level floors, the d that marks every one as a directory, and the two reflexes (/etc for settings, /var/log for logs) that answer most real questions. Every command you saw, you typed yourself.

The Important Files module ends with one real Linux machine, the Important Files capstone mission, and that is where you walk this map for real. A VM boots just for you, with its own live filesystem. It hands you objectives that use exactly what you meet across this module: the hierarchy you just learned, and the key system files inside /etc that the next lessons open up one by one. One difference from here: the mission shows no commands. You read the objective, you recall the path, you type it. That recall is what makes the map stick.

Finish the other Important Files lessons, then go walk a real filesystem for yourself.

Practice The Filesystem Hierarchy in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.