Objective. Students will navigate the Linux directory hierarchy and perform file and directory operations using core commands without reference aids.
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.
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) 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:
`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.
`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
```
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.
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.
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.
Answer each question, then check it. Nothing is recorded; this is your own practice.
A free tech program — complimentary, as our commitment to get America working. Help us build VoTechWorks. Tell us what works, what doesn’t, and what you want to learn.