All Modules Why Linux Filesystem Hands-on Lab Cheat Sheet

Linux Essentials

Get comfortable in the terminal — the language every DevOps tool speaks.

Module 2 · Navigate, manage files, and control a Linux system. Free · Local.

Beginner Foundations ~45 min

What You'll Learn

  • Open a terminal on any OS (Mac, Windows via WSL, or Linux)
  • Understand the Linux filesystem tree and absolute vs. relative paths
  • Navigate and manage files: cd, ls, mkdir, cp, mv, rm, cat
  • Read and change file permissions with chmod
  • Inspect and stop processes; install software with a package manager

Prerequisites: Module 1. No prior terminal experience.

Why Linux Matters

The overwhelming majority of servers, containers, and cloud machines run Linux. Docker images are Linux. Kubernetes nodes are Linux. When you SSH into a server, you land in a Linux shell. If you can drive Linux from the command line, you can operate almost any infrastructure.

The terminal is a superpower

The graphical desktop is friendly but slow and un-automatable. The terminal (a.k.a. shell / command line) lets you do things precisely, repeatably, and in scripts — which is the whole point of DevOps.

Getting a terminal

Your OSHow to get a Linux shell
LinuxYou already have one — open "Terminal".
macOSOpen "Terminal" (it's Unix; nearly identical commands).
WindowsInstall WSL: run wsl --install in PowerShell, reboot, open "Ubuntu".

The Filesystem Tree

Linux organizes everything under a single root, /. There are no "C: drives" — just one tree:

/ ← root of everything ├── home/ │ └── you/ ← your home directory (shortcut: ~) ├── etc/ ← system configuration files ├── var/ ← logs and variable data (e.g. /var/log) ├── usr/ ← installed programs └── tmp/ ← temporary files
ConceptMeaning
Absolute pathStarts from root: /home/you/notes. Works from anywhere.
Relative pathFrom where you are now: notes/app.py.
~Your home directory shortcut.
. / ..Current directory / parent directory.

Hands-on Lab: Drive the Terminal

Open your terminal and follow along. Everything here is safe and reversible.

1

Where am I? What's here?

pwd # print working directory (where you are) ls # list files here ls -la # long listing, including hidden files
2

Move around

cd ~ # go to your home directory cd /var/log # go somewhere absolute cd .. # up one level cd - # back to the previous directory
3

Create files and folders

cd ~ mkdir devops-practice cd devops-practice touch hello.txt # create an empty file echo "my first note" > hello.txt # write text into it cat hello.txt # print its contents
4

Copy, move, rename, delete

cp hello.txt backup.txt # copy mv backup.txt notes.txt # rename (move) mkdir archive mv notes.txt archive/ # move into a folder rm hello.txt # delete a file

rm is forever

There's no recycle bin on the command line. rm -rf folder deletes a folder and everything in it, permanently. Double-check the path before you hit Enter — especially with sudo.

5

Read files like a pro

cat archive/notes.txt # whole file less archive/notes.txt # scroll (press q to quit) head -n 5 archive/notes.txt # first 5 lines grep "note" archive/notes.txt # find lines containing "note"
6

Permissions: read, write, execute

Run ls -l and you'll see strings like -rwxr-xr--. They describe who can do what:

- rwx r-x r-- │ │ │ └── others: read only │ │ └─────── group: read + execute │ └──────────── owner: read + write + execute └──────────────── file type (- = file, d = directory)
chmod +x script.sh # make a file executable chmod 644 notes.txt # owner read/write, others read (common for files) chmod 755 script.sh # owner all, others read/execute (common for scripts)

The numbers

read=4, write=2, execute=1. Add them per group: 7=rwx, 6=rw-, 5=r-x, 4=r--. So 755 = owner rwx, group r-x, others r-x.

7

Processes & system

ps aux # list running processes top # live process/resource view (q to quit) df -h # disk space free -h # memory (Linux) kill <PID> # stop a process by its ID
8

Install software (package manager)

On Debian/Ubuntu, apt installs software. (sudo = run as administrator.)

sudo apt update # refresh the package list sudo apt install -y tree # install the 'tree' command tree ~/devops-practice # see your folder as a tree

You can now operate Linux

Navigate, manage files, set permissions, inspect processes, install software. That's the daily toolkit for working on any server or inside any container.

Command Cheat Sheet

CommandWhat it does
pwdShow current directory
ls -laList all files, detailed
cd <path>Change directory (~ home, .. up, - back)
mkdir / touchMake a directory / empty file
cp / mv / rmCopy / move-rename / delete
cat / less / head / tailView file contents
grep "x" fileSearch text in a file
chmod / chownChange permissions / ownership
ps aux / topList / monitor processes
kill <PID>Stop a process
sudo apt install xInstall a package (Debian/Ubuntu)
man <cmd>Read a command's manual

Time-savers

Tab auto-completes names. recalls previous commands. Ctrl+C cancels a running command. Ctrl+L (or clear) clears the screen.

Troubleshooting

MessageMeaning & fix
No such file or directoryWrong path or typo. Check with ls and pwd.
Permission deniedYou lack rights — try sudo, or fix with chmod.
command not foundNot installed or misspelled. Install it with apt.
Stuck in a pager (less/man)Press q to quit.
Terminal frozenPress Ctrl+C to cancel the current command.

Your Challenge

  • Create a folder structure project/src and project/docs in one command (hint: mkdir -p).
  • Create a file, make it executable, and confirm with ls -l.
  • Use grep to find every line containing "error" in /var/log/syslog (or any log file).
  • Bonus: read the manual for ls (man ls) and find the flag that sorts by modification time.
mkdir -p project/src project/docs tree project # bonus: ls -lt (sort by time)

Recap & What's Next

You can now

Move around the Linux filesystem, manage files, control permissions, inspect processes, and install software — all from the terminal. This is the bedrock skill for everything that follows.

Next up: Module 3 — Bash Scripting, where you'll chain these commands into reusable scripts that automate the boring stuff.

Linux Essentials

Objectives Why Linux Filesystem Hands-on Lab Cheat Sheet Troubleshooting Challenge Recap