🐧Module 2: Filesystem & Navigation
πŸŽ’ Beginner Linux Explorer Mission

Filesystem and Navigation

Learn how Linux organizes files, how paths work, and how to move confidently using pwd, ls -la, cd, mkdir, and touch.

Start the map Run the guided lab
/ /home /etc /var /tmp ~/linux-lab

What you will be able to do

By the end, a beginner should be able to navigate safely, understand basic paths, read simple directory listings, and create a practice directory and file.

1. Linux filesystem mental model: one big upside-down tree 🌳

Linux has a single filesystem tree. Everything starts at /, called the root directory. Drives, users, logs, configuration, devices, and programs all appear somewhere under this tree.

/ root of the whole filesystem β”œβ”€β”€ home user homes β”‚ └── student your personal workspace β”‚ └── linux-lab practice folder β”‚ └── file1.txt practice file β”œβ”€β”€ etc system configuration β”œβ”€β”€ var changing data and logs β”œβ”€β”€ tmp temporary files β”œβ”€β”€ usr userland programs/resources β”œβ”€β”€ bin essential commands └── root root user's home directory

/

The root directory is the top of the Linux filesystem. Every absolute path starts here.

Key rule: / is the root directory. /root is different; it is the home directory of the administrative root user.
Analogy: Think of Linux as a city. / is the city gate. /home is the residential area. /etc is the control room. /var/log is the incident diary. You move through the city using cd and inspect places using ls.

2. Linux directory structure reference

This table is intentionally beginner-friendly. It is not the full filesystem standard, but it covers the places you will meet early in real Linux administration.

DirectorySimple meaningReal-world useBeginner caution
/Start of everythingTop of the filesystem treeDo not randomly create or delete things directly under /.
/homeUser personal spacesRegular user files and dotfiles like .bashrcBest place for beginner labs.
/etcSystem settingsConfiguration files for OS and servicesInspect carefully; edit only when you know the service and have backup/permission.
/varChanging dataLogs, cache, spool, application dataLarge logs can fill disks.
/var/logSystem/application logsTroubleshooting boot, service, auth, package issuesLog names differ by distro/service.
/tmpTemporary workspaceShort-lived temporary filesDo not store important long-term data here.
/usrUserland software/resourcesPrograms, libraries, documentationUsually managed by packages, not manual editing.
/binEssential commandsCommands needed for basic system useOn many modern distros, /bin may link to /usr/bin.
/rootRoot user's homeAdministrative user's personal directoryNot the same as /.
/devDevice filesDisks, terminals, random devicesDo not modify device files casually.
/procKernel/process infoLive process and kernel informationVirtual filesystem; not normal files on disk.
/sysKernel/device modelHardware/kernel interfaceAdvanced area; mostly read-only for beginners.

3. Absolute vs relative path: GPS vs local directions 🧭

An absolute path starts from /. A relative path starts from wherever you are right now.

Absolute path

Starts with /. It works no matter where you are.

absolute example
student@linux:~$ cd /etc
student@linux:/etc$ pwd
/etc

Memory hook: absolute path = full GPS address.

Relative path

Does not start with /. Linux interprets it from your current directory.

relative example
student@linux:~$ cd linux-lab
student@linux:~/linux-lab$ pwd
/home/student/linux-lab

Memory hook: relative path = β€œturn left from here”.

Path Detective Trainer

Assume you are currently in /home/student. Choose a command and predict where you land.

Current location
/home/student
➜
Command
Result:

Important: Linux paths are case-sensitive. Documents, documents, and DOCUMENTS can be three different names.

4. Command cards: what to use and when

These are the minimum commands for beginner filesystem navigation.

pwd

Print Working Directory. Shows where you are now.

$ pwd
/home/student

ls

Lists visible files and directories in the current directory.

$ ls
linux-lab

ls -la

Long listing, all entries, including hidden names that start with ..

$ ls -la

cd

Changes directory. Example: cd /etc, cd ~, cd ...

$ cd /etc

mkdir

Makes a directory in the current location unless you give a path.

$ mkdir linux-lab

touch

Creates an empty file if absent, or updates timestamp if it already exists.

$ touch file1.txt
Command anatomy: In ls -la, ls is the command. -l means long format. -a means all files. -la is just -l and -a combined.

5. Decode ls -la: read the evidence board πŸ•΅οΈ

ls -la is not just a list. It tells you file type, permissions, links, owner, group, size, date, and name.

-rw-r--r-- 1 student student 0 Aug 17 23:05 file1.txt

Click any part of the line

Each field explains something different about the file. Start with the leftmost field.

Directory vs regular file

drwxr-xr-x 2 student student 4096 Aug 17 23:05 linux-lab
-rw-r--r-- 1 student student    0 Aug 17 23:05 file1.txt

First character d means directory. First character - means regular file.

Hidden files

$ ls -la ~
.bashrc
.profile
.ssh

A hidden file is simply a name that starts with a dot. It is hidden from plain ls, but shown by ls -a or ls -la.

6. Guided lab: build your first Linux practice room πŸ§ͺ

Run these commands on Ubuntu, Debian, Rocky Linux, RHEL, Fedora, or most Linux distributions. The exact username and file dates may differ.

Prerequisite: Open a terminal as a regular user. This lab does not require sudo.

Step 1: Where am I?

command
$ pwd
/home/student

Your output uses your actual username, for example /home/jp.

Step 2: List everything

command
$ ls -la
drwx------  ... student student ... .
drwxr-xr-x  ... root    root    ... ..
-rw-r--r--  ... student student ... .bashrc

You should see hidden entries beginning with .. Exact files differ by distro and shell.

Step 3: Visit system settings

command
$ cd /etc
$ pwd
/etc

/etc is absolute, so it works from anywhere.

Step 4: Return home

command
$ cd ~
$ pwd
/home/student

~ means your home directory.

Step 5: Create a lab directory

command
$ mkdir linux-lab
$ cd linux-lab
$ pwd
/home/student/linux-lab

If mkdir linux-lab says β€œFile exists”, the directory already exists. Use cd linux-lab or create a different name.

Step 6: Create an empty file

command
$ touch file1.txt
$ ls -la
-rw-r--r-- 1 student student 0 Aug 17 23:05 file1.txt

touch creates the file if it does not exist. If it already exists, it updates the timestamp.

Safe cleanup: Only after confirming you are in your home directory, remove the lab with:
$ cd ~
$ pwd
/home/student
$ rm -r linux-lab
Do not copy destructive commands from the internet unless you fully understand the current directory and target. Avoid dangerous patterns like rm -rf / and careless rm -rf *.

7. Practice mode: hide the notes, solve the mission 🎯

Use this after the guided lab. Try each task first, then reveal the answer.

8. Common beginner mistakes: controlled crash simulator ⚠️

Click a mistake and learn what happened before it happens on a real server.

Choose a mistake

Each explanation gives the symptom, the cause, and the safer fix.

9. Real-world admin use cases

Filesystem navigation is not theory. It is the first step in troubleshooting almost every Linux issue.

Check configuration

$ cd /etc
$ ls

Used when checking OS, network, user, SSH, web server, and service configuration files.

Check logs

$ cd /var/log
$ ls

Used when services fail, login breaks, packages fail, or the system behaves strangely.

Return to safety

$ cd ~
$ pwd

Used when you want to work in your own user space instead of sensitive system directories.

Admin habit: Before changing anything, run pwd. Before deleting anything, run pwd and ls -la. Tiny habit, huge accident prevention.

10. Teach-back checkpoint

Teaching it back is one of the fastest ways to retain it. Write a short answer, then compare with the model answer.

Prompt 1

Explain the difference between /etc and etc.

Model answer: /etc is an absolute path because it starts from /. etc is a relative path because Linux searches for an etc directory inside the current directory.

Prompt 2

Why does ls not show .bashrc, but ls -la does?

Model answer: Names beginning with . are hidden from normal ls. The -a option means β€œall”, so ls -la shows hidden entries too.

11. Final Boss Lab: the filesystem treasure run 🏁

Complete this without looking at answers first. Then use the checklist to verify.

boss lab commands
$ pwd
$ ls -la
$ cd /etc
$ pwd
$ cd ~
$ mkdir linux-lab
$ cd linux-lab
$ touch file1.txt
$ ls -la
$ cd ~

12. Mini assessment: check readiness

Answer all questions. Score guidance: 8–10 = ready for next module, 5–7 = review paths and lab, 0–4 = repeat guided mode with the coach.

13. Lab worksheet

Use this during training. It turns passive watching into active practice.

14. Printable cheat sheet

This is the keep-forever part. Print it or keep it beside your terminal.

Essential commands

pwdShow current location
lsList visible files
ls -laLong listing with hidden files
cd /etcGo to absolute path /etc
cd ~Go to your home directory
cd ..Go one level up
mkdir linux-labCreate a directory
touch file1.txtCreate empty file or update timestamp

Symbols and meanings

/Root directory; top of filesystem
~Your home directory
.Current directory
..Parent directory
.bashrcHidden file because name starts with dot
Absolute pathStarts with /
Relative pathStarts from current directory
Safety mantra: Before deletion: pwd, then ls -la, then carefully check the target.

15. Validation checklist for trainers

Use this to confirm the lab worked on a learner machine.

optional validation script
$ cd ~
$ mkdir -p linux-lab
$ touch linux-lab/file1.txt
$ test -d linux-lab && echo 'PASS: linux-lab exists'
$ test -f linux-lab/file1.txt && echo 'PASS: file1.txt exists'
$ pwd
$ ls -la linux-lab
Expected: Both PASS lines appear, pwd shows your home directory, and ls -la linux-lab shows file1.txt.