Sessions 65 + 68 · Week 17 · Handout R
Networking — commands, concepts, and exercises
Name

Date
Interface and addresses
ip addr showall interfaces + IPs
hostname -Imachine's IP addresses
ip route showrouting table, gateway
ss -tulpnlistening ports + services
Testing and diagnostics
ping -c 4 hosttest reachability
traceroute hosttrace route to host
dig hostnameDNS lookup details
nslookup hostsimple DNS resolution
curl
curl urlfetch and print
curl -o file urlsave to file
curl -I urlheaders only
curl -L urlfollow redirects
curl -X POST -d dataPOST request
DNS configuration files
/etc/hostslocal DNS overrides
/etc/resolv.confDNS server addresses
cat /etc/hostsread current overrides
Exercises — fill in commands and answers
1.What is your machine's local IP address? Which interface carries it?
Command
IP address
Interface name
2.What is the default gateway? What does that device do?
Command
Gateway IP
Its role
3.Run curl https://api.ipify.org — what IP does it return? How does it differ from your local IP?
Returned IP
Why different
What is NAT?
4.Use ss -tulpn. List 3 services listening on your machine — port, protocol, service name.
Port Protocol Service What it does
5.Add an entry to /etc/hosts mapping "mycomputer" to 127.0.0.1. Test it with ping. Write the entry you added.
hosts entry
ping result
Sessions 66 + 67 · Week 17 · Handout S
SSH — connection and key authentication setup
Name

Date
Work through these steps in sequence. Each step builds on the last. Record every command you run and the key results. Partner A = server, Partner B = client — then swap.
Step 1Install and start SSH server (server machine)
Install: sudo apt install openssh-server
Enable and start: sudo systemctl enable --now ssh
Verify running: systemctl status ssh — shows "active (running)"
Find IP: ip addr show
Server IP:   Username:
Step 2Connect with password (client machine)
Connect: ssh username@server_ip
Accept host key fingerprint (type "yes")
Run hostname — does it show the server's hostname?
Run who — can you see your session listed?
who output shows:
Disconnect: exit or Ctrl+D
Step 3Generate SSH key pair (client machine)
Generate: ssh-keygen -t ed25519 -C "yourname-course"
Accept default path (~/.ssh/id_ed25519)
Set a passphrase (recommended) or press Enter for none
View public key: cat ~/.ssh/id_ed25519.pub
Public key starts with:
Step 4Copy public key to server
Copy: ssh-copy-id username@server_ip
SSH again — are you prompted for a password? (Should not be)
Check permissions: ls -la ~/.ssh/
File Required permissions Actual permissions
~/.ssh/700
id_ed25519600
id_ed25519.pub644
Test: set private key to 644, try SSH — read the error. Set it back to 600.
Step 5SSH config shortcut
Create or edit ~/.ssh/config with nano
Host partner
    HostName server_ip
    User username
    IdentityFile ~/.ssh/id_ed25519
Test: ssh partner — does it connect?
Transfer a file: scp ~/scripts/greet.sh partner:/tmp/
Key concepts — answer without notes
Why is SSH key authentication more secure than password authentication?
What is the difference between the public key and the private key? What happens if someone gets your private key?
Session 72 · Week 19 · Handout T
Debugging — diagnosing and fixing broken systems
Name

Date
For each scenario: describe the problem precisely, list every diagnostic command you run (with output), identify the root cause (not the symptom), apply the fix, and verify it worked.
Debugging method: (1) describe precisely, (2) reproduce reliably, (3) gather information, (4) hypothesise, (5) test one change, (6) find root cause not symptom
Scenario 1 — broken service
A service unit file has a syntax error. systemctl start fails.
Precise problem description
Diagnostic commands run
Root cause (specific, not "syntax error")
Fix applied + verification command
Scenario 2 — permission denied
A script exists. The path is correct. Running it gives "permission denied."
Diagnostic commands run
What ls -l shows about the file
Root cause
Fix + verification
Scenario 3 — missing command
A script calls a command that is not installed. "Command not found."
Command that was missing
How you found the package name
Install command
Verification
Scenario 4 — SSH service config error
SSH will not start after editing sshd_config. Use the built-in config tester.
Built-in config test command
Error output (exact)
Line with error + what was wrong
Fix + verification
Reflection
What is the difference between a symptom and a root cause? Give one example from today's scenarios.
Sessions 74 + 75 · Week 20 · Handout U
Cron and git — reference and exercises
Name

Date
Cron syntax
MIN HOUR DOM MON DOW command
 *    *    *   *   *  every minute
 0    3    *   *   *  3am daily
 0    3    *   *   0  3am every Sunday
*/5   *    *   *   *  every 5 minutes
 0   9-17  *   *  1-5 9am-5pm weekdays
crontab -eedit your crontab
crontab -llist current crontab
crontab -rremove all (careful)
Always use absolute paths. Always redirect: >> /log 2>&1
Core git workflow
git initcreate repository
git statuswhat changed
git add .stage all changes
git commit -m "msg"save snapshot
git log --onelinecompact history
git diffunstaged changes
git checkout -- fileundo file changes
git show HASHview a commit
Cron exercises
1.Write a crontab entry to run your backup script at 2:30am every day.
Entry
2.Decode these cron entries — when does each run?
0 0 1 * *
*/10 * * * 1-5
30 8 * * 1
3.Why must cron jobs use absolute paths? Give a real example of what breaks without them.
Git exercises
4.Initialise a git repo in ~/dotfiles. Add and commit your .bashrc. Show the log entry.
Commands
git log shows
5.Accidentally delete 2 lines from .bashrc. Use git to recover the file. Show the command.
Recovery command
Why this works
6.What are the three areas in git? What command moves changes from area 1 to area 2? From area 2 to area 3?
Area 1
Area 2
Area 3
Session 80 · Week 20 · Handout V
Phase 5 vocabulary checklist
Name

Date
Tick the green box if you can explain the term clearly. Tick the red box if you need to review it.
I can explain this
I need to review
Week 16 — bash scripting depth
case statement
bash array
string manipulation ${}
$(( arithmetic ))
getopts / OPTARG
heredoc (EOF)
set -euo pipefail
trap EXIT / ERR
lockfile pattern
Week 17 — networking and SSH
IP address / IPv4
private IP / NAT
port number
DNS / TTL
ip addr / ip route
ping / traceroute
ss -tulpn
SSH / port 22
host key fingerprint
scp
public key / private key
authorized_keys
ssh-keygen -t ed25519
~/.ssh/config
curl / wget
Week 18 — processes and services
process / PID
process state (R/S/D/Z)
ps aux / htop
SIGTERM / SIGKILL
background (&)
systemd / PID 1
unit file
systemctl
journalctl -u
Weeks 19–20 — logs, archives, cron, git, disk
/var/log/syslog
/var/log/auth.log
journalctl -p err
root cause vs symptom
tar -czf / -xzf
gzip / zip
crontab -e / -l
cron time syntax
cron minimal environment
git init / add / commit
git log / diff / show
git branch / merge
df -h / du -sh
apt clean / autoremove
sudoers / visudo
Phase 5 reflection
1. What is the single most useful skill you learned in Phase 5? Why?
2. Describe your health-check script: what it monitors, one interesting implementation, one problem you debugged.
3. What do you plan to build for the Phase 6 final project? Why?