Skip to main content

The Linux File System

Before we look at folders, letโ€™s answer the most common question: What exactly is Linux?

What is Linux?

Linux is not a single "app" or a company product like Windows. It is an Open-Source Kernel (the core engine of an OS).

Think of Linux as the Engine of a car. Different companies take that engine, add a different "body" (UI), "seats" (Apps), and "paint" (Themes), and call it a Distribution (or Distro).

  • Ubuntu: The friendly "Sedan" for beginners.
  • CentOS/RHEL: The heavy-duty "Truck" for big companies.
  • Kali Linux: The "Spy Car" for security experts.

The "Everything is a File" Philosophyโ€‹

This is the most important concept in Linux.

  • Your Hard Drive? It's a file located at /dev/sda.
  • Your Keyboard? It's a file located at /dev/input/event0.
  • Your Process? Itโ€™s a folder full of files in /proc.

Why does this matter? Because it means you can use the same simple tools (like cat, grep, or nano) to fix a website, check your RAM, or configure a database. You don't need a special "Dashboard" for everything.

The Linux Tree Structure (FHS)โ€‹

In Windows, you have C:\ and D:\. In Linux, everything starts from a single point called the Root, represented by a forward slash: /.

The Essential Directories for DevOps:โ€‹

DirectoryHuman NameWhat's inside?
/RootThe parent of every other folder on the system.
/binBinariesThe "Power Tools" (commands like ls, cp, mkdir).
/etcEt CeteraThe Control Room. Almost all configuration files live here.
/homeHomeThe personal "Apartment" for each user (e.g., /home/ajay).
/var/logLogsThe "Black Box." If an app crashes, the reason is written here.
/tmpTemporaryThe "Trash Can." Files here are usually deleted on reboot.
/rootRoot HomeThe private home for the "God Mode" (Superuser) user.
/devDevicesWhere your hardware "files" live (Hard drives, USBs).

Absolute vs. Relative Pathsโ€‹

As a new coder at CodeHarborHub, you must know how to navigate the tree.

  1. Absolute Path: The full address starting from the Root.

    • Example: /home/ajay/projects/codeharborhub
    • (Like giving someone your full mailing address: Country, City, Street, House No.)
  2. Relative Path: The address starting from where you are now.

    • Example: If you are already in /home/ajay, the relative path is just projects/codeharborhub.
    • (Like telling someone in your house, "The kitchen is the next door on the left.")
The Symbols
  • . (Single Dot): Refers to the Current directory.
  • .. (Double Dot): Refers to the Parent directory (one level up).
  • ~ (Tilde): Refers to your Home directory.

Why DevOps Engineers Love This Structureโ€‹

Imagine you are deploying a website.

  1. You put your code in /var/www/html.
  2. You configure the webserver (Nginx) in /etc/nginx.
  3. You check why itโ€™s not working in /var/log/nginx/error.log.

Because every Linux server follows this Filesystem Hierarchy Standard (FHS), once you learn it, you can manage any server in the worldโ€”whether it's at Google, Amazon, or on your local machine.

How to "Look" at the File Systemโ€‹

When you open your terminal, use these three magic commands to explore:

  • pwd: Print Working Directory (Where am I?).
  • ls: List (What's in here?).
  • cd: Change Directory (Move me somewhere else).
Why this matters for you

As a developer at CodeHarborHub, you will spend a lot of time in the /etc folder configuring web servers like Nginx and in the /var/log folder debugging why your Node.js app won't start. Mastering this "Map" is 50% of the battle!

Summary Checklistโ€‹

  • I understand that Linux is a "Kernel" and Ubuntu is a "Distro."
  • I know that / is the root of the entire system.
  • I can explain why /etc and /var/log are important for DevOps.
  • I know the difference between an Absolute and a Relative path.
Mastery Moment

You now know the "Map" of the Linux world. You won't get lost anymore! Next, we need to learn who is allowed to open these files.