Context before commands

Command library.

Every course example in one place. Read the context and safety label before copying.

Use your browser’s find command to locate an example, or search across the site.

Navigation & files

Where am I?

Safe in practice folder

Prints your current folder.

Run from ~/linux-practice

pwd

From mission 1: Fundamental Navigation

Identify your Linux environment

Read-only system view

Shows the kernel, architecture, distribution details, and (when applicable) the WSL distribution name. These checks are safe on Ubuntu, most Linux distributions, and WSL.

Run from anywhere

uname -srmo
cat /etc/os-release
if [ -n "$WSL_DISTRO_NAME" ]; then echo "WSL distro: $WSL_DISTRO_NAME"; fi

From mission 1: Fundamental Navigation

List files

Safe in practice folder

Shows files in normal, detailed, hidden, human-readable, and time-sorted views.

Run from ~/linux-practice

ls
ls -l
ls -la
ls -lh
ls -ltr

From mission 1: Fundamental Navigation

Create first practice items

Safe in practice folder

Creates harmless files and a folder inside the sandbox.

Run from ~/linux-practice

touch file1.txt file2.txt file3.txt
mkdir testdir
ls -la

From mission 1: Fundamental Navigation

Move to home and back

Safe in practice folder

Moves home, then returns to the sandbox.

Run from ~/linux-practice

cd ~
pwd
cd ~/linux-practice
pwd

From mission 2: Changing Directories and Understanding Paths

Practice parent folders

Safe in practice folder

Shows how .. climbs up one level at a time.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p files/demo
cd files/demo
pwd
cd ..
pwd
cd ../..
pwd

From mission 2: Changing Directories and Understanding Paths

Return to previous directory

Read-only system view

cd - switches back to the last directory you were in, without retyping the path.

Run from ~/linux-practice

cd ~/linux-practice
cd /tmp
pwd
cd -
pwd

From mission 2: Changing Directories and Understanding Paths

Read-only visit to /etc

Read-only system view

Visits Ubuntu configuration folders without editing anything.

Run from anywhere

cd /etc
pwd
ls -l | head -20
cd ~/linux-practice

From mission 2: Changing Directories and Understanding Paths

Create files

Safe in practice folder

Creates empty files and demonstrates brace expansion.

Run from ~/linux-practice

cd ~/linux-practice
touch myfile.txt
touch file_{1..5}.txt
ls -l

From mission 3: Creating and Inspecting Files

Create and remove empty directories safely

Safe in practice folder

mkdir -p creates missing parent folders without failing when they already exist. rmdir removes only an empty directory, making it a safer first removal command than rm -r.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p files/{inbox,archive}
ls -ld files files/inbox files/archive
rmdir files/archive

From mission 3: Creating and Inspecting Files

Inspect file metadata

Safe in practice folder

Shows size, permissions, owner, timestamps, and inode.

Run from ~/linux-practice

stat myfile.txt

From mission 3: Creating and Inspecting Files

Identify file type

Read-only system view

Compares a text file with a real executable.

Run from ~/linux-practice

echo 'Hello Ubuntu' > myfile.txt
file myfile.txt
file /bin/bash

From mission 3: Creating and Inspecting Files

Write and append

Safe in practice folder

Creates a file and appends another line. Remember: > overwrites.

Run from ~/linux-practice

cd ~/linux-practice
echo 'First line' > journal.txt
echo 'Second line' >> journal.txt
cat journal.txt

From mission 4: Writing and Reading File Content

Number and reverse lines

Safe in practice folder

Shows numbered lines and reverse order.

Run from ~/linux-practice

cat -n journal.txt
tac journal.txt

From mission 4: Writing and Reading File Content

Save output with tee

Safe in practice folder

Saves a directory listing while also displaying it.

Run from ~/linux-practice

ls -la | tee listing.txt
cat listing.txt

From mission 4: Writing and Reading File Content

Create a large file

Safe in practice folder

Generates a harmless file for viewing practice.

Run from ~/linux-practice

cd ~/linux-practice
for i in {1..100}; do echo "This is line number $i"; done > large.txt

From mission 5: Viewing Larger Files

Preview file parts

Safe in practice folder

Shows first lines, last lines, and counts.

Run from ~/linux-practice

head -n 5 large.txt
tail -n 5 large.txt
wc large.txt
wc -l large.txt

From mission 5: Viewing Larger Files

Open with less

Safe in practice folder

Press Space for next page, /pattern to search, and q to quit.

Run from ~/linux-practice

less -N large.txt

From mission 5: Viewing Larger Files

Text & pipelines

Overwrite and append

Safe in practice folder

Demonstrates the difference between replace and append.

Run from ~/linux-practice

cd ~/linux-practice
echo 'First' > output.txt
echo 'Second' >> output.txt
cat output.txt

From mission 6: Redirection Operators

Capture errors

Safe in practice folder

Sends stderr to a file instead of the screen.

Run from ~/linux-practice

ls missing-file 2> error.log
cat error.log

From mission 6: Redirection Operators

Use a heredoc

Safe in practice folder

Creates multi-line text safely.

Run from ~/linux-practice

cat << 'EOF' > document.txt
Line 1
Line 2
Variables like $HOME are not expanded here
EOF
cat document.txt

From mission 6: Redirection Operators

Sort and count

Safe in practice folder

Sorts lines and counts adjacent duplicates after sorting.

Run from ~/linux-practice

cd ~/linux-practice
echo -e 'banana\napple\ncherry\napple' > fruits.txt
sort fruits.txt | uniq -c

From mission 7: Pipes and Filters

Translate characters

Safe in practice folder

Transforms text through a pipeline.

Run from ~/linux-practice

echo 'Hello World' | tr 'a-z' 'A-Z'
echo 'Hello World' | tr ' ' '_'

From mission 7: Pipes and Filters

Cut and align fields

Safe in practice folder

Extracts fields and prints a simple table.

Run from ~/linux-practice

echo 'Name:Age:City' > people.txt
echo 'Jane:25:London' >> people.txt
cut -d: -f1,3 people.txt
column -t -s: people.txt

From mission 7: Pipes and Filters

Basic grep

Safe in practice folder

Finds matching and non-matching lines.

Run from ~/linux-practice

cd ~/linux-practice
echo -e 'Apple\napple\nAPPLE\nBanana\napricot' > fruits.txt
grep -i 'apple' fruits.txt
grep -v 'apple' fruits.txt

From mission 8: Grep: Search Master

Regex anchors

Safe in practice folder

Uses start, end, and OR matching.

Run from ~/linux-practice

grep '^A' fruits.txt
grep 'e$' fruits.txt
grep -E 'apple|Banana' fruits.txt

From mission 8: Grep: Search Master

Recursive search

Safe in practice folder

Searches through folders.

Run from ~/linux-practice

mkdir -p projects/search-demo
echo 'secret pattern' > projects/search-demo/file.txt
grep -r 'pattern' projects

From mission 8: Grep: Search Master

Substitute safely

Safe in practice folder

Prints changed output without modifying the file.

Run from ~/linux-practice

cd ~/linux-practice
echo -e 'Hello\nWorld\nHello World' > text.txt
sed 's/Hello/Hi/' text.txt
sed 's/Hello/Hi/g' text.txt

From mission 9: Sed: Stream Editing Safely

Print selected lines

Safe in practice folder

Shows only selected lines.

Run from ~/linux-practice

sed -n '2p' text.txt
sed -n '1,2p' text.txt

From mission 9: Sed: Stream Editing Safely

In-place with backup

Caution

Changes the file and keeps a backup copy.

Run from ~/linux-practice

sed -i.bak 's/Hello/Hi/g' text.txt
cat text.txt
cat text.txt.bak

From mission 9: Sed: Stream Editing Safely

Print fields

Safe in practice folder

Prints columns and line numbers.

Run from ~/linux-practice

cd ~/linux-practice
echo -e 'Name Age City\nJohn 30 NYC\nJane 25 LA' > data.txt
awk '{print $1, $3}' data.txt
awk '{print NR, $0}' data.txt

From mission 10: Awk Fundamentals

CSV separator

Safe in practice folder

Uses comma as a field separator and calculates values.

Run from ~/linux-practice

echo -e 'Product,Price,Quantity\nApple,1.50,100\nBanana,0.75,200' > inventory.csv
awk -F, 'NR>1 {print $1, $2 * $3}' inventory.csv

From mission 10: Awk Fundamentals

Total calculation

Safe in practice folder

Accumulates a total and prints it at the end.

Run from ~/linux-practice

awk -F, 'NR>1 {total += $2 * $3} END {print total}' inventory.csv

From mission 10: Awk Fundamentals

Safety & control

Create search lab

Safe in practice folder

Creates harmless test files.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p find-lab/subdir/nested
touch find-lab/file1.txt find-lab/file2.pdf find-lab/old.log find-lab/subdir/test.txt

From mission 11: Find Command Mastery

Find files

Safe in practice folder

Searches by name and type.

Run from ~/linux-practice

find find-lab -name '*.txt'
find find-lab -type f
find find-lab -type d
find find-lab -empty

From mission 11: Find Command Mastery

Act on results

Safe in practice folder

Lists matching files and prints logs before any deletion.

Run from ~/linux-practice

find find-lab -name '*.txt' -exec ls -lh {} \;
find find-lab -name '*.log' -print

From mission 11: Find Command Mastery

Delete only after printing

Caution

Deletes only the practice .log file after you have confirmed the match.

Run from ~/linux-practice

find find-lab -name '*.log' -delete

From mission 11: Find Command Mastery

Practice chmod

Safe in practice folder

Changes permissions on your own practice file.

Run from ~/linux-practice

cd ~/linux-practice
touch permissions_demo.txt
chmod 644 permissions_demo.txt
ls -l permissions_demo.txt
chmod 600 permissions_demo.txt
ls -l permissions_demo.txt

From mission 12: File Permissions Deep Dive

Make a script executable

Safe in practice folder

Adds execute permission to a practice script.

Run from ~/linux-practice

echo 'echo Hello' > scripts/hello.sh
chmod +x scripts/hello.sh
./scripts/hello.sh

From mission 12: File Permissions Deep Dive

System special bits example

Explanation only

These examples explain SUID and sticky bit. Do not run them; Ubuntu already manages system permissions.

Run from do not run

chmod u+s /usr/bin/passwd
chmod +t /tmp

From mission 12: File Permissions Deep Dive

Who am I?

Read-only system view

Shows your username, IDs, and groups.

Run from ~/linux-practice

cd ~/linux-practice
whoami
id
groups

From mission 13: Ownership and Groups Without Fear

Inspect ownership

Read-only system view

Shows ownership on your file and reads user/group databases.

Run from ~/linux-practice

touch owned-by-me.txt
ls -l owned-by-me.txt
head -5 /etc/passwd
head -5 /etc/group

From mission 13: Ownership and Groups Without Fear

Optional admin ownership examples

Optional admin

These change real system state. They are explained, not required for this safe course.

Run from advanced users only

sudo chown username:groupname file.txt
sudo adduser testlearner
sudo userdel -r testlearner

From mission 13: Ownership and Groups Without Fear

View processes

Read-only system view

Shows current and system processes.

Run from ~/linux-practice

ps
ps aux | head -15
pgrep -l bash

From mission 14: Process Management

Create and stop a practice job

Caution

Starts one harmless background process, captures its exact PID with $!, then stops and waits for that same process. This remains deterministic even when other jobs already exist.

Run from ~/linux-practice

cd ~/linux-practice
sleep 100 &
practice_pid=$!
echo "Started practice PID: $practice_pid"
jobs -l
kill "$practice_pid"
wait "$practice_pid" 2>/dev/null || true
jobs -l

From mission 14: Process Management

Broad process killing examples

Caution

Useful but broad. Prefer job number or exact PID while learning.

Run from ~/linux-practice

killall sleep
pkill -f 'sleep 200'

From mission 14: Process Management

Inspect variables

Read-only system view

Reads common environment variables.

Run from ~/linux-practice

printenv | head -20
echo $HOME
echo $USER
echo $SHELL
echo $PATH

From mission 15: Environment Variables

Export a temporary variable

Safe in practice folder

Creates and removes a temporary variable.

Run from ~/linux-practice

export MY_NAME='Linux Learner'
echo $MY_NAME
bash -c 'echo Child sees: $MY_NAME'
unset MY_NAME

From mission 15: Environment Variables

Practice PATH safely

Safe in practice folder

Temporarily adds your practice bin folder to PATH.

Run from ~/linux-practice

mkdir -p ~/linux-practice/bin
export PATH="$HOME/linux-practice/bin:$PATH"
which ls
whereis bash
type cd

From mission 15: Environment Variables

Find the command your shell will run

Read-only system view

command -v is the portable way to find a command or shell builtin. command -V gives a fuller explanation, while env lists exported variables for the current process.

Run from ~/linux-practice

command -v ls
command -v cd
command -V cd
env | sort | head -20

From mission 15: Environment Variables

Applied workflows

Create and inspect aliases

Safe in practice folder

Creates a friendly listing shortcut.

Run from ~/linux-practice

alias ll='ls -la'
ll
alias ll

From mission 16: Aliases and Command Shortcuts

Remove aliases

Safe in practice folder

Removes the temporary shortcut.

Run from ~/linux-practice

unalias ll
alias

From mission 16: Aliases and Command Shortcuts

Bypass an alias

Safe in practice folder

Runs the original command even if an alias exists.

Run from ~/linux-practice

alias ls='ls --color=auto'
command ls
\ls

From mission 16: Aliases and Command Shortcuts

View history

Read-only system view

Shows recent commands.

Run from ~/linux-practice

history 10

From mission 17: History and Command Recall

Repeat simple commands

Caution

Repeats the previous harmless echo command.

Run from ~/linux-practice

echo 'safe repeat demo'
!!

From mission 17: History and Command Recall

History clearing example

Caution

Clears current shell memory history. Explanation only for most learners.

Run from ~/linux-practice

history -c

From mission 17: History and Command Recall

Brace expansion

Safe in practice folder

Creates multiple practice files quickly.

Run from ~/linux-practice

echo file_{1..5}.txt
touch file_{1..5}.txt
ls file_*.txt

From mission 18: Shell Expansions and Wildcards

Globbing lab

Safe in practice folder

Shows common filename patterns.

Run from ~/linux-practice

mkdir -p glob-lab
cd glob-lab
touch a.txt b.txt c.txt 1.txt 22.txt abc.txt
echo *.txt
echo ?.txt
echo [ab].txt
cd ..

From mission 18: Shell Expansions and Wildcards

Safe cleanup

Caution

Removes only the glob-lab folder created in the sandbox.

Run from ~/linux-practice

rm -rf glob-lab

From mission 18: Shell Expansions and Wildcards

Hard link demo

Safe in practice folder

Shows two names for the same file data.

Run from ~/linux-practice

cd ~/linux-practice
echo 'Original content' > original.txt
ln original.txt hardlink.txt
ls -li original.txt hardlink.txt
echo 'Added line' >> original.txt
cat hardlink.txt

From mission 19: Hard Links and Symbolic Links

Symlink demo

Safe in practice folder

Creates and inspects a symbolic link.

Run from ~/linux-practice

echo 'Target content' > target.txt
ln -s target.txt symlink.txt
ls -l symlink.txt
readlink symlink.txt
cat symlink.txt

From mission 19: Hard Links and Symbolic Links

Broken symlink

Caution

Demonstrates a broken symlink inside the practice folder.

Run from ~/linux-practice

rm target.txt
cat symlink.txt

From mission 19: Hard Links and Symbolic Links

Create archive lab

Safe in practice folder

Creates a folder to archive.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p archive-lab/docs
echo 'file1' > archive-lab/file1.txt
echo 'readme' > archive-lab/docs/README.txt

From mission 20: Archiving and Compression

Tar and inspect

Safe in practice folder

Creates a compressed tar archive and lists its contents.

Run from ~/linux-practice

mkdir -p backups
tar -czvf backups/archive-lab.tgz archive-lab
tar -tvf backups/archive-lab.tgz

From mission 20: Archiving and Compression

Extract safely

Safe in practice folder

Extracts into a dedicated restored folder.

Run from ~/linux-practice

mkdir -p restored
tar -xzvf backups/archive-lab.tgz -C restored
ls -R restored

From mission 20: Archiving and Compression

Inspect, do not edit

Read-only system view

Reads the beginning of your real .bashrc without changing it.

Run from ~/linux-practice

cat ~/.bashrc | head -30

From mission 29: Customizing Your Shell Safely

Temporary prompt

Safe in practice folder

Changes and restores the prompt only in the current shell.

Run from ~/linux-practice

OLD_PS1=$PS1
PS1='Practice> '
echo 'Prompt changed for this session'
PS1=$OLD_PS1

From mission 29: Customizing Your Shell Safely

Practice alias file

Safe in practice folder

Sources aliases from a removable practice file.

Run from ~/linux-practice

echo "alias showdate='date +%Y-%m-%d'" >> ~/linux-practice/my_aliases
source ~/linux-practice/my_aliases
showdate
unalias showdate

From mission 29: Customizing Your Shell Safely

Real .bashrc edit example

Explanation only

This permanently modifies your real shell startup file. Explanation only in this course.

Run from do not run

echo "alias la='ls -A'" >> ~/.bashrc

From mission 29: Customizing Your Shell Safely

Create final project

Safe in practice folder

Creates a complete mini project.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p final_project/{src,docs,bin} backups
cd final_project
echo 'main function' > src/main.c
echo '# README' > docs/README.md
cat << 'EOF' > bin/script.sh
#!/usr/bin/env bash
echo 'Processing...'
for f in src/*; do
  echo "Found: $f"
  wc -l "$f"
done
EOF
chmod +x bin/script.sh

From mission 30: Grand Finale and Cleanup

Review skills

Safe in practice folder

Uses archive, find, grep, head, xargs, du, and script execution.

Run from ~/linux-practice/final_project

cd ~/linux-practice/final_project
tar -czvf ../backups/final-project-v1.tgz src docs bin
tar -tzf ../backups/final-project-v1.tgz
find . -name '*.sh' -exec ls -lh {} \;
grep -r 'function' .
head -2 docs/README.md
find . -type f \( -name '*.c' -o -name '*.sh' \) -print0 | xargs -0 wc -l
du -sh .
./bin/script.sh

From mission 30: Grand Finale and Cleanup

Remove final project only

Caution

Deletes only final_project inside the sandbox.

Run from ~/linux-practice

cd ~/linux-practice
rm -rf final_project

From mission 30: Grand Finale and Cleanup

System & network

Measure sandbox

Safe in practice folder

Shows size of the practice folder and its contents.

Run from ~/linux-practice

cd ~/linux-practice
du -sh
du -sh * 2>/dev/null

From mission 21: Disk Usage and Storage Info

Filesystem free space

Read-only system view

Shows root filesystem free space and type.

Run from ~/linux-practice

df -h /
df -hT /

From mission 21: Disk Usage and Storage Info

Observe block devices

Read-only system view

Reads storage and mount information only.

Run from ~/linux-practice

lsblk
findmnt | head -20
mount | head -20

From mission 21: Disk Usage and Storage Info

Read-only package search

Read-only system view

Searches and inspects packages without installing anything.

Run from ~/linux-practice

apt search 'text editor' | head -20
apt show nano | head -20
apt list --installed | head -20

From mission 22: Ubuntu Package Management Safely

Detect your package manager

Read-only system view

Checks which common package-manager command is available without changing the system. Follow the APT examples only on Ubuntu, Debian, or their WSL distributions.

Run from anywhere

command -v apt || true
command -v dnf || true
command -v pacman || true
command -v zypper || true

From mission 22: Ubuntu Package Management Safely

Inspect installed files

Read-only system view

Uses dpkg to inspect installed package information.

Run from ~/linux-practice

dpkg -l | head -20
dpkg -l | grep -i bash
dpkg -L bash | head -20

From mission 22: Ubuntu Package Management Safely

Optional install/remove pattern

Optional admin

This changes the real Ubuntu system. It is optional and not part of the removable sandbox guarantee.

Run from advanced users only

sudo apt update
sudo apt install sl -y
sudo apt remove sl

From mission 22: Ubuntu Package Management Safely

Connectivity checks

Read-only system view

Sends ICMP probes to a public address and the local loopback interface. A reply is useful evidence; no reply is inconclusive because networks and hosts may block ICMP.

Run from ~/linux-practice

ping -c 2 8.8.8.8
ping -c 1 localhost

From mission 23: Basic Networking Commands

Check DNS separately from connectivity

Read-only system view

Separates name lookup from ICMP reachability. If the IP address replies but name lookup fails, DNS is the likely layer to investigate. A failed ping alone does not prove the network is offline.

Run from ~/linux-practice

getent hosts example.com
ping -c 1 example.com
ping -c 1 1.1.1.1

From mission 23: Basic Networking Commands

Fetch a web page

Safe in practice folder

Downloads into the sandbox downloads folder. -L follows redirects; -I fetches headers only.

Run from ~/linux-practice

mkdir -p ~/linux-practice/downloads
cd ~/linux-practice/downloads
curl -IL https://example.com
curl -L -o example.html https://example.com
head -5 example.html

From mission 23: Basic Networking Commands

Inspect network info

Read-only system view

Views addresses, routes, and listening ports.

Run from ~/linux-practice

ip addr show | head -30
ip route show
ss -tuln | head -20
hostname -I

From mission 23: Basic Networking Commands

Memory and uptime

Read-only system view

Shows memory, uptime, and short virtual memory stats.

Run from ~/linux-practice

free -h
uptime
vmstat 1 2

From mission 24: System Monitoring and Performance

Process snapshots

Read-only system view

Shows a non-interactive top snapshot and memory-heavy processes.

Run from ~/linux-practice

top -b -n 1 | head -20
ps aux --sort=-%mem | head -10

From mission 24: System Monitoring and Performance

Logs and watch

Read-only system view

Reads recent logs only when systemd is running, then starts a repeating clock. This handles non-systemd distributions and WSL environments where systemd is disabled. Stop watch with Ctrl+C.

Run from ~/linux-practice

if command -v journalctl >/dev/null && [ "$(ps -p 1 -o comm=)" = systemd ]; then
  journalctl -n 20 --no-pager
else
  echo "systemd journal is not available in this environment"
fi
watch -n 2 date

From mission 24: System Monitoring and Performance

Automation

Hello script

Safe in practice folder

Creates and runs a first script.

Run from ~/linux-practice

cd ~/linux-practice/scripts
cat << 'EOF' > hello.sh
#!/usr/bin/env bash
echo "Hello, $USER!"
echo "Today is $(date)"
echo "You are in $PWD"
EOF
chmod +x hello.sh
./hello.sh

From mission 25: Shell Scripting Basics

Arguments script

Safe in practice folder

Shows common script argument variables.

Run from ~/linux-practice

cat << 'EOF' > args.sh
#!/usr/bin/env bash
echo "Script name: $0"
echo "First argument: $1"
echo "All arguments: $@"
echo "Number of arguments: $#"
EOF
chmod +x args.sh
./args.sh one two three

From mission 25: Shell Scripting Basics

Exit status

Read-only system view

Shows non-zero failure and zero success statuses.

Run from ~/linux-practice

ls /nonexistent
echo "Exit status: $?"
ls /bin/bash
echo "Exit status: $?"

From mission 25: Shell Scripting Basics

If/else demo

Safe in practice folder

Creates a basic conditional script.

Run from ~/linux-practice

cd ~/linux-practice/scripts
cat << 'EOF' > if_demo.sh
#!/usr/bin/env bash
num=${1:-10}
if [ "$num" -gt 10 ]; then
  echo "Greater than 10"
elif [ "$num" -eq 10 ]; then
  echo "Exactly 10"
else
  echo "Less than 10"
fi
EOF
chmod +x if_demo.sh
./if_demo.sh 25

From mission 26: Shell Scripting Control Structures

For loop

Safe in practice folder

Loops over fixed words. Saved in scripts/ alongside if_demo.sh.

Run from ~/linux-practice

cd ~/linux-practice/scripts
cat << 'EOF' > for_demo.sh
#!/usr/bin/env bash
for fruit in apple banana cherry; do
  echo "I like $fruit"
done
EOF
chmod +x for_demo.sh
./for_demo.sh

From mission 26: Shell Scripting Control Structures

Case statement

Safe in practice folder

Matches one value against multiple patterns. Saved in scripts/ alongside the other demo scripts.

Run from ~/linux-practice

cd ~/linux-practice/scripts
cat << 'EOF' > case_demo.sh
#!/usr/bin/env bash
answer=${1:-yes}
case "$answer" in
  yes|y|YES|Y) echo "You agreed." ;;
  no|n|NO|N) echo "You disagreed." ;;
  *) echo "Invalid input" ;;
esac
EOF
chmod +x case_demo.sh
./case_demo.sh yes

From mission 26: Shell Scripting Control Structures

Read current crontab

Read-only system view

Checks that the crontab command exists before listing entries, and distinguishes a missing tool from an empty or inaccessible user crontab. Scheduling also requires a working cron-compatible service.

Run from ~/linux-practice

if ! command -v crontab >/dev/null; then
  echo "crontab is not installed in this environment"
else
  crontab -l 2>/dev/null || echo "No user crontab exists, or access is unavailable"
fi

From mission 27: Scheduling Without Breaking Your Crontab

Safe scheduling simulation

Safe in practice folder

Simulates repeated scheduled work without editing crontab.

Run from ~/linux-practice

cd ~/linux-practice
mkdir -p logs
for i in {1..3}; do echo "Simulated run at $(date)" >> logs/schedule-demo.log; sleep 2; done
cat logs/schedule-demo.log

From mission 27: Scheduling Without Breaking Your Crontab

Dangerous cleanup example

Explanation only

Removes the entire user crontab. Explanation only; do not use as course cleanup.

Run from do not run

crontab -r

From mission 27: Scheduling Without Breaking Your Crontab

Find command info

Read-only system view

Discovers command locations, shell builtins, and descriptions. Prefer command -v over which in scripts because command is provided by the shell.

Run from ~/linux-practice

command -v ls
command -V cd
whereis bash
type cd
whatis ls
apropos 'list directory' | head -10

From mission 28: Locating Files and Reading Documentation

Manual pages

Read-only system view

Opens the ls manual. Press q to quit.

Run from ~/linux-practice

man ls

From mission 28: Locating Files and Reading Documentation

Optional locate setup

Optional admin

Installs plocate (the modern locate on Ubuntu 22.04+) and updates its database. Optional only.

Run from advanced users only

sudo apt install plocate -y
sudo updatedb
locate bashrc | head

From mission 28: Locating Files and Reading Documentation

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.