Topic 07

Files, Folders, and the Filesystem

Concept

You already use files and folders every day — you name a document, drop it in a folder, drag that folder into another one. None of that is new. What you may never have seen is the system underneath: how the operating system actually keeps track of every one of those files on the disk, names them, and finds the right one in an instant.

That whole organizing system has a name. The filesystem is the part of the operating system that decides how files are stored, named, and located on storage. From here on we'll call it the filesystem. Once you can see it, a lot of later technical talk — about paths, directories, and config files — stops being mysterious.

A folder tree, with one file at the end of a path
/
the root, where the tree begins
home
a folder inside the root
you
your personal folder
notes.txt
a file at the end of the branch
full path: /home/you/notes.txt

What a file really is

To you, a file is a document, a photo, a song. Underneath, every file is the same kind of thing: a named chunk of data sitting on storage — the disk you met in the last chapter. Whether it's a spreadsheet or a video, it's bytes on the disk with a name attached so the computer can find it again.

The name and the contents are separate. You can rename a file without changing a single byte inside it, and you can change everything inside while keeping the name. The filesystem's job is to keep that connection straight — this name points to that chunk of data, over here on the disk.

Folders as a tree

A folder — also called a directory, the word you'll see in technical contexts — is not itself a chunk of data like a file. It's a container: a way to group files, and other folders, under one name. The two words mean the same thing; this course will say folder, but expect directory everywhere later.

Because a folder can hold other folders, the whole thing forms a tree. There's one folder at the very top — on the servers this course leans toward, it's written simply as a slash, /, and called the root. Inside the root are more folders, inside those are more, and somewhere out at the tips of the branches sit your actual files.

Picture a filing cabinet, but a strange one: each drawer can hold not just papers but smaller cabinets, each of those holds smaller ones still, all the way down. The papers are your files; every cabinet and drawer is a folder. The whole nested arrangement is what we mean by the filesystem tree.

A path: the address of a file

If files are scattered across a deep tree of folders, the computer needs a precise way to say exactly which one you mean. That address is called a path: the full route from the top of the tree down to the file, written out folder by folder.

A path like /home/you/notes.txt reads left to right as a set of directions. Start at the root, /; go into the folder named home; inside it, the folder named you; and there sits the file notes.txt. Each slash is just a separator between one step and the next. You won't type paths in this course — but you'll see them constantly, and now you can read one.

Back to the cabinet: the path is the full label that tells you exactly which cabinet, which drawer, and which folder inside it to open. Give the same directions twice and you land on the same single file every time — which is the whole point of a path.

File types and extensions

Most file names end with a short tag after a dot — .txt, .jpg, .mp3. That tag is called the extension, and it's a hint about what kind of data the file holds: .txt for plain text, .jpg for a photo, .mp3 for audio. The operating system uses it to guess which app should open the file.

Here's the part worth getting right: the extension is only a label, not the contents. Rename song.mp3 to song.txt and the bytes inside don't change one bit — you've only changed the hint, and now the computer will try to open music as text and get confused. The real nature of a file is its actual data; the extension just advertises it.

Common Confusions
  • "Deleting a shortcut deletes the file." A shortcut (or alias) is a tiny pointer to a file living elsewhere. Throw the shortcut away and the real file, at its real path, is untouched.
  • "The extension is the file type." The extension is only a hint in the name. The true type is the actual data inside; renaming .mp3 to .txt doesn't turn music into text.
  • "Two different files can have the same full path." A full path points to exactly one file. One path, one file — that's what makes a path a reliable address.
  • "A folder is just another kind of file." A file is a chunk of data; a folder is a container that groups files and other folders. They sit at different points in the tree and do different jobs.
Why It Matters
  • Almost everything on a server — its programs, its settings, even the way it talks to hardware — is stored as files in this same tree. "It's all files" is a real principle you'll meet again.
  • A program's settings usually live in a config file at a known path; "edit the file at /etc/..." is everyday work in the cloud, Linux, and DevOps courses.
  • Paths appear in nearly every technical course — error messages, install guides, and tutorials all point at files by path, and now you can read them.
  • Docker images, which you'll meet later, are built as stacked sets of files in a tree — the same folders-and-files idea, just packaged up to ship.

Knowledge Check

Underneath, what is a file?

  • A named chunk of data stored on the disk
  • A container that holds other files and folders
  • A piece of information that exists only while it is open in memory
  • The short tag after the dot, such as .txt or .jpg

What is a path, such as /home/you/notes.txt?

  • The data stored inside the file, written out as text
  • The full route through the folders that locates one specific file
  • The short extension at the end of the name that says which app should open the file
  • A label that several different files can share at once

You rename song.mp3 to song.txt. What actually happens to the file?

  • Its audio data is converted into plain text
  • The file is deleted because the extension no longer matches
  • Nothing inside changes, but the computer now mishandles it
  • Both the name and the underlying data are rewritten together

You got correct