Day 1: Navigating the Linux File System
Now that you understand how commands are structured, it is time to learn your way around the server.
If you are coming from Windows, you are probably used to drive letters like C:\ or D:\. Linux does not use drive letters. Instead, it uses a single, unified structure called the Filesystem Hierarchy.
1. The Root of the Tree (/)
Think of the Linux filesystem like an upside-down tree.
The absolute top of this tree is called the Root directory, and it is represented by a single forward slash: /. Every single file, folder, program, and attached hard drive on a Linux server lives somewhere underneath this single root slash.
2. The Navigation Toolkit
To survive in the terminal, you only need three core commands. Think of them as your eyes, your map, and your feet.
pwd (Print Working Directory): Your GPS Pin Because there is no graphical map telling you where you are, it is very easy to get lost. If you ever forget which folder you are currently sitting inside, type pwd. The terminal will print out your exact, absolute location starting from the root (e.g., /home/student).
ls (List): Your Eyes Once you know where you are, you need to see what is around you. Typing ls will list all the files and folders contained inside your current directory. It is the equivalent of opening a folder on your Windows desktop to look at the icons inside.
cd (Change Directory): Your Feet When you see a folder you want to enter, you use cd followed by the name of that folder. If you type ls and see a folder named workspace, you can step inside it by typing: cd workspace
3. Absolute vs. Relative Paths
The hardest part of learning cd is understanding how to give the system directions. There are two ways to tell the shell where to go:
-
Relative Paths (Directions from where you are): If you are standing in
/home/studentand want to go into theworkspacefolder, you just typecd workspace. You gave it directions relative to your current location. -
Absolute Paths (The exact GPS coordinate): If you want to jump across the entire server into the system configurations folder, you cannot just type
cd etc. The shell will look in your current room, fail to find it, and give you an error. You must give it the absolute path starting from the root:cd /etc.
4. The Essential Navigation Shortcuts
Linux engineers use a few universal shortcuts to jump around instantly. Memorize these three symbols:
-
~(Tilde): Represents your personal home directory. No matter where you are on the server, typingcd ~will instantly teleport you back to/home/student. -
.(Single Dot): Represents your current directory. (This will be very important later when running scripts!). -
..(Double Dot): Represents the parent directory (one step up). If you are deep inside/home/student/workspace, typingcd ..acts like a “Back” button, moving you up to/home/student.
Use the interactive visualizer below to practice how Absolute and Relative paths move your “Current Location” around the Linux filesystem tree.