🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › Linux/Bash for Web & Software Development › Lesson 2
TEC-WEB46-06 · Lesson 2 · 14 clock hours · lab

Filesystem Navigation and Basic Commands

Objective. Students will navigate the Linux directory hierarchy and perform file and directory operations using core commands without reference aids.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

The Linux Filesystem: A Map for Developers

Every Linux system organizes its files in a single inverted tree rooted at `/` (pronounced "root"). Unlike Windows, there are no drive letters — every device, directory, and file hangs off that one root. Understanding this layout is essential for deploying web applications, writing shell scripts, and passing the CompTIA Linux+ exam.

The Filesystem Hierarchy Standard (FHS)

The Filesystem Hierarchy Standard (FHS) defines the purpose of each major directory. You can read the full specification on your VM with `man hier`. Key directories every web developer must know:

Core Navigation Commands

`pwd` (print working directory) tells you exactly where you are in the tree. Run it whenever you feel lost.

`ls` lists directory contents. Useful flags:

`cd` changes your working directory. `cd ..` moves up one level; `cd ~` returns you to your home directory; `cd -` returns to the previous directory.

File and Directory Operations

`mkdir` creates a directory. Add `-p` to create intermediate parents in one command: `mkdir -p projects/site/css`.

`rmdir` removes an empty directory only.

`cp` copies files or directories. Use `-r` (recursive) to copy a directory tree: `cp -r src/ backup/`.

`mv` moves or renames files and directories: `mv old_name.txt new_name.txt`.

`rm` deletes files permanently — there is no Recycle Bin in the terminal. Use `-r` to remove a directory tree. Double-check your path before pressing Enter. The command `rm -rf /` or a mistyped path can destroy a system. Many administrators alias `rm` to `rm -i` (interactive, prompts before each deletion) as a safety habit.

`find` searches the filesystem by name, type, size, or modification time:

```

find /home/alice -name "*.html" -type f

find /tmp -mtime +7 # files not modified in over 7 days

```

Absolute vs. Relative Paths

An absolute path starts with `/` and describes the full location from root: `/var/www/html/index.html`. A relative path is measured from your current directory: `../css/style.css`. Using absolute paths in scripts prevents errors caused by running the script from an unexpected location.

Safety Points

1. Think before `rm -r`. Verify the path with `pwd` and `ls` first. There is no undo.

2. Never run unknown commands as root. Use your normal user account for all lab exercises. Elevating to root when not required is a leading cause of accidental data loss and security breaches.

3. Permissions matter. Before copying files to system directories (e.g., `/etc`), confirm you have the right permissions and understand what you are changing. Misconfigured web server files can expose sensitive data.

4. Shared VMs. In a classroom environment, be aware that `/tmp` is world-writable — do not store anything sensitive there.

Putting It Together

A typical web project might be scaffolded like this:

```

mkdir -p ~/projects/mysite/{html,css,js,assets}

```

The `{}` brace expansion creates four subdirectories in one command. Running `ls -R ~/projects/mysite` confirms the tree. This is the kind of operation you will reproduce in today's timed drill.

Key terms8

Filesystem Hierarchy Standard (FHS)A published standard that defines the names, locations, and purposes of directories on Linux and Unix-like systems, ensuring consistency across distributions.
Absolute pathA file or directory location expressed starting from the root directory (`/`), uniquely identifying that location regardless of the user's current working directory.
Relative pathA file or directory location expressed in relation to the current working directory, without a leading `/`.
Working directoryThe directory the shell is currently operating in; displayed by the `pwd` command and used as the reference point for relative paths.
Root directoryThe top-most directory of the Linux filesystem, represented by a single forward slash (`/`). All other directories and files descend from it.
Brace expansionA shell feature that generates multiple strings from a single pattern containing curly braces, used to create several directories or files with one command (e.g., `mkdir -p site/{css,js,html}`).
`find` commandA Linux command that searches a directory tree for files and directories matching criteria such as name, type, size, or modification time.
Hidden fileA file or directory whose name begins with a dot (`.`); it does not appear in a standard `ls` listing but is visible with `ls -a`.
In class: Timed command drill: students complete a structured worksheet requiring them to use pwd, ls, cd, mkdir, rmdir, cp, mv, rm, and find to reproduce a specified directory tree in under 20 minutes. · Pair challenge: given a scrambled project directory, partners use find and ls flags to identify misplaced files and move them to the correct locations, documenting each command in a lab log. · Reflection write-up: students describe the Filesystem Hierarchy Standard (FHS) directories (/etc, /var, /home, /usr, /tmp) and explain what a web developer is likely to store in each.
Materials: Student Linux VMs, FHS reference (man hier), lab worksheet PDF, lab log template
Check: Instructor observes directory tree reproduction; all required files in correct locations and all commands logged correctly — 80% of steps completed correctly to pass.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

CompTIA Linux+ — System Management
1. A developer runs `pwd` and sees `/home/dev`. Which command moves them directly to the root of the filesystem?
CompTIA Linux+ — System Management
2. Which directory, as defined by the Filesystem Hierarchy Standard, is the correct location for system-wide application configuration files?
CompTIA Linux+ — System Management
3. A student wants to list all files in the current directory, including hidden files, in long format. Which command achieves this?
CompTIA Linux+ — System Management
4. Which command creates the nested directory path `projects/site/css` even if `projects` and `site` do not yet exist?
CompTIA Linux+ — System Management
5. A developer needs to find every file with a `.conf` extension inside `/etc`. Which command is correct?
CompTIA Linux+ — System Management
6. Which of the following best describes the risk of using `rm -r` without verifying the path first?
CompTIA ITF+ — IT Concepts and Terminology
7. According to the FHS, which directory is intended for temporary files that may be deleted when the system reboots?
CompTIA Linux+ — System Management
8. A student types `cd -` in the terminal. What is the expected result?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.