519 words
3 minutes
Filesystem Layout

Now, that you’ve got your Linux VM setup. Its time to discuss about Linux’s filesystem, it is crucial to understand this concept, so you wont be confused where all your files goes. In this guide ill cover

  • How Linux filesystem is different from Windows
  • The Root Directory
  • Essential Directories You Need to Know

How Linux is different from Windows#

Unlike Windows which you have drive letters like C:\, D:, etc. Linux does not work that way. Instead everything starts from a single root directory called / (just a forward slash), and everything branches out from there like a tree.

You can think of Windows like having multiple trees (one for each drive), while Linux is one big tree where everything is connected

alt text

The Root Directory#

The / is the top of the filesystem hierarchy. Every single file and directory on your Linux system exists under this root. Even if you plug in a USB drive, it gets “mounted” (attached) somewhere under /

The “Everything is a File” Philosophy#

One of Linux’s core concepts is that everything is treated as a file. Your keyboard? A file. Your monitor? A file. Your hard drive? A file. This might seem weird, but it makes the system incredibly consistent, this means you interact with everything using the same basic tools and commands.

Essential Directories You Need to Know#

/home: Your Personal Space. This is where YOUR stuff lives. Each user gets their own folder here. If your username is “poly”, your home directory would be /home/poly. This is where you’ll save documents, downloads, pictures, and personal files. Think of it as similar to C:\Users\YourName in Windows.

/root: The Superuser’s Home. This is the home directory for the root user (the system administrator account). Don’t confuse this with / which is the root of the filesystem.

/etc: Configuration Files. This directory contains system-wide configuration files. Want to change how your system behaves? The settings are probably in /etc. As a beginner, you’ll mostly just read files here, not edit them.

/bin & /usr/bin: Essential Programs. These directories contain executable programs that you can run. When you try to execute a command line like ls or cp, Linux looks for those programs there. And yes, ls and cp are also standalone executable binaries. There’s actually not much of a difference between /bin & /usr/bin, On modern Linux systems, /bin often just points to /usr/bin, but both exist for compatibility reasons due to history.

/tmp: Temporary Files. This is where temporary files are stored. The system and applications use this for files they only need briefly. Files here might get deleted when you reboot.

/var:Variable Data. This directory contains files that change frequently, like log files and databases. If you’re troubleshooting something, you might check /var/log to see system logs.

/dev: Devices. Remember how i said “everything is a file” in Linux? Well now you know, even your hardware devices appear as files in /dev. Your hard drive might be /dev/sda, for example.

What’s Next?#

Now that you’ve learnt the basics of where everything lives on Linux, you’re ready to use commands to navigate directories in Linux. In the next post, I’ll talk about the essential Linux commands like cd, pwd, ls, cp, cat.

alt text