Skip to content
VLSI Mentor

Linux & Bash · Part I · Module 2 · The Filesystem and Paths

One Tree: The Filesystem Hierarchy

Module 1 gave you the shell. This module gives you somewhere to point it. Everything you will do from here — open a file, run a script, search a project, save a result — starts by naming a location, and you cannot name a location until you know how Linux arranges them. Linux arranges them in one tree. Not one tree per disk, not one tree per user: one tree for the whole machine, with a single starting point at the top. This chapter builds that picture and fills in the parts of it you will meet most often.

Foundation13 min readLinuxPart IFundamentalsFilesystemMental Model

Part I · Module 2 · Chapter 2.1 · One Tree: The Filesystem Hierarchy

1. Where Is the C: Drive?

If you have used Windows, you expect storage to be divided into lettered drives. C: is one place. D: is a separate place. A second disk gets its own letter, and a network share gets another. Each letter is the top of its own tree.

Linux does not work that way, and the difference is not cosmetic.

Linux has exactly one tree. It has one starting point at the very top. Every file and every directory on the machine sits somewhere below that single point — including files on a second disk, on a USB stick, or on a file server in another building.

There are no drive letters to learn. There is one tree, and the whole skill is knowing how to point at a place in it.

2. Three Words, in Plain English

Three words are used constantly from here on. Each one is simple once stated plainly.

Directory. A directory is a container for names. You may know it as a folder; on Linux the usual word is directory, and this course uses that word. A directory holds entries — the names you see when you list it. Each entry names either a file or another directory.

Parent and child. If a directory project holds a directory rtl, then project is the parent of rtl, and rtl is a child of project. That is the whole relationship. Any directory can hold more directories, which can hold more directories, for as deep as anyone cares to go.

Hierarchy. When containers hold containers like that, the arrangement is called a hierarchy — or, less formally, a tree. The word tree is used because the picture branches: one thing at the top, more things below it, more things below those.

3. The Root: a Single /

The directory at the very top of the tree is called the root directory. It is written as a single forward slash:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
/

That one character is its whole name. It is the only directory on the machine with no parent — there is nothing above it, because it is the top.

Everything else has an address that can be traced back to it. That is the property that makes the single tree useful: given any file anywhere on the machine, there is exactly one path up from it to /, and therefore exactly one full name for it. Chapter 2.2 turns that into a notation you can type.

The filesystem as one tree. A single root written as a forward slash sits at the top. Below it are bin, etc, home, tmp and opt. Below home is one user directory called engineer, which is a typical home directory.binetcengineeryour homehometmpopt/the root
Figure 1 — the top of the tree. The root is a single forward slash with no parent. The directories below it are ordinary directories with ordinary names; each can hold more directories, and this continues for as deep as a system is organised. Your own home directory is one of those ordinary directories, normally one level below home.

The lines in Figure 1 mean contains. They are not arrows and there is no flow to follow: read the picture top-down, and a line simply says the directory above holds the directory below.

Figure 1 shows five directories under the root because those are the five you will meet first. A real machine has roughly a dozen. The rest follow exactly the same rule.

4. What Lives Where

Top-level directory names are not random. They follow a long-standing convention, so a Linux machine you have never touched is still broadly navigable.

DirectoryWhat it holds
/binPrograms — the files behind commands like ls and cp.
/etcSystem-wide settings, stored as plain text files.
/homeOne directory per user. Your own files live in yours.
/tmpScratch space. Anyone may write here, and it is cleared periodically.
/optAdd-on software installed outside the package manager — often where large commercial tools land.
/varData that changes while the system runs, including system logs.
/usrThe bulk of the installed system: more programs, shared libraries, documentation.
/devDevices, presented as if they were files.

Two of those deserve a note now.

/etc is text. Settings on Linux are overwhelmingly ordinary text files you can read with ordinary commands. There is no separate settings database to learn. Module 4 is where you start reading them.

/opt is where big tools often go. Commercial engineering software frequently installs under /opt, because it does not come from the distribution's package manager — the distinction Chapter 1.1 drew. If someone tells you a tool is "in opt", that is what they mean.

5. Your Home Directory

One directory matters more than the rest, because it is yours.

Each user account gets a home directory — the place for your own files and your own settings. The usual location is inside /home, named after the account:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
/home/engineer

Chapter 1.4 had you run whoami; the name it printed is normally the name of your home directory. It is where a new session usually starts, and it is the one place on a shared machine you can reliably write to.

A home directory is a perfectly ordinary directory. Nothing about it is special to the kernel. What makes it yours is ownership and permission — Module 5's subject — not its position in the tree.

6. The Example Used Throughout This Module

To reason about locations you need somewhere concrete to reason about. The rest of Module 2 uses one small project, inside the home directory above:

Azvya Education Pvt. Ltd.VLSI Mentor
/home/engineer/project — the example used by every chapter in Module 2
/home/engineer/project
├── docs
├── rtl
│   ├── alu.sv
│   └── counter.sv
├── scripts
│   └── run.sh
└── sim
    └── logs

Read that as a tree, exactly like Figure 1: project holds four directories; rtl holds two files; scripts holds one; sim holds a directory called logs.

The shape is loosely borrowed from how engineering projects are often arranged — design sources in one directory, scripts in another, results in a third — and you need to know nothing about what is inside those files to use it. alu.sv is just a file name here.

7. One Tree, Several Disks

A fair question: if the machine has two disks, where does the second one go?

It goes inside the same tree, attached to an empty directory somewhere. That attachment is called mounting, and the directory it attaches to is its mount point. After mounting, you reach the second disk by walking into that directory like any other.

This is why Linux needs no drive letters. Storage is not a separate top-level thing; it is grafted into the one tree.

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
/            ← the main disk
/data        ← a second disk, mounted here
/proj/shared ← a network file server, mounted here

Walking into /data reads the second disk. Nothing in the path says so, and that is the point: where a file lives physically is a separate question from where it sits in the tree.

For now this matters in exactly one way, and it is worth carrying: two directories that look like neighbours can be on completely different storage, with different speed, different capacity and different backup arrangements. Part II returns to this where it starts to bite, under project areas and quotas. Nothing you do in Part I depends on it.

8. The Slash Does Two Jobs

A small but genuinely confusing detail, best settled now.

The / character means two different things depending on where it appears.

At the very start of a path, it names the root directory:

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
/

Between two names, it separates them — "the thing on the left contains the thing on the right":

Azvya Education Pvt. Ltd.VLSI Mentor
Snippet
/home/engineer/project

Read that one piece at a time: start at the root, go into home, go into engineer, go into project. The first slash is the root; the other two are separators.

This is why / on its own is a complete, valid location while home/ on its own is not a complete location at all. Chapter 2.2 makes that difference precise.

9. Misconceptions

"There must be a C: drive somewhere." There is not. There is one tree with one root. A second disk appears as a directory inside it, per §7.

"/ and ~ are the same thing." They are not, and confusing them is the most common beginner error in this whole module. / is the root of the entire machine. ~ is a shortcut for your home directory, which sits several levels below the root. Chapter 2.3 covers ~ properly; for now, keep them apart: / is the top of everything, your home is one small branch of it.

"Every Linux system has exactly these directories." The common ones are reliable; the details are a distribution decision, as Chapter 1.1 explained. ls / is the authority for a given machine.

"/bin is where my programs should go." /bin holds programs that came with the system. Your own work belongs in your home directory. On a shared machine you will usually find you cannot write to /bin at all — which is the system protecting itself, not a problem to solve.

"Directories are files." This is a half-truth that causes trouble if taken literally. A directory is its own kind of thing: it holds entries, which are names paired with what they point at. You cannot read a directory the way you read a text file. Module 6 makes the relationship between names and files precise.

10. Check Your Understanding

Question 1. Name the single directory that has no parent, and say how it is written.

Question 2. A colleague says their data is "on the D drive". Explain in two sentences how that storage would be reached on a Linux machine instead.

Question 3. Using the table in §4, which top-level directory would you expect to hold each of these: a system log, a configuration file for a service, a large commercial tool installed by hand, a temporary file a program created while running?

Question 4. In /home/engineer/project, how many of the slashes name the root directory, and how many are separators?

Question 5. Looking at the example tree in §6: what is the parent of logs? What are the children of rtl?

Question 6. Why can two directories that sit next to each other in the tree have completely different amounts of free space?

11. Remember

  • Linux has one tree. One root at the top, everything else below it. No drive letters.
  • The root is written / — a single forward slash, the only directory with no parent.
  • A directory holds entries; each entry names a file or another directory. Parent means the container; child means the thing contained.
  • Top-level names follow a convention: /bin programs, /etc settings as text, /home users, /tmp scratch, /opt add-on software, /var changing data, /usr the bulk of the system. The convention is reliable; the details are a distribution decision.
  • Your home directory is an ordinary directory, usually /home/<your name>. What makes it yours is ownership, not its position.
  • Extra disks and network shares are mounted into the same tree, so the path does not tell you which physical storage a file sits on.
  • The slash does two jobs: it names the root at the start of a path, and separates names everywhere else.
  • / is not ~. The root is the top of the machine; your home is one small branch of it.
  • A project tree has its own conventional layout too — Chapter 23.1 maps the seven kinds of directory almost every design repository is built from.

You can now picture where things are. The next chapter gives you the notation for pointing at them, and the distinction that decides whether a name means the same thing tomorrow.

Where this fits

Part of the Linux & Bash curriculum.