the labsimulated shell · 10 lessons
Terminal Lab
A real shell syntax with a simulated filesystem, so you can break things safely. Each lesson checks the command you actually typed and unlocks the next one. Progress is stored in this browser only.
current task
01 · Find where you are
Print your current directory with pwd, then list what is around you with ls.
Tip: ↑ and ↓ walk your command history. Ctrl+L clears the screen. help lists everything supported.
troubleshootingthe first week
Ten errors everyone hits
Every message below is real. The pattern is always the same: read the error literally, then check the three usual suspects — spelling, permission, space.
command not found
bash: sl: command not found — the shell searched every directory in $PATH and found no such program.
Check: which ls prints the full path if it exists. echo $PATH shows where the shell looks.
Fix: usually a typo, or the package is not installed. Try command -v tree; if it is missing, install it (sudo apt install tree).
Permission denied
bash: ./script.sh: Permission denied — the file exists but lacks the execute bit for you.
Check: ls -l script.sh shows -rw-r--r--. Says it plainly: no x anywhere.
Fix: chmod +x script.sh. If the problem is writing to a system file, you need root: sudo — and you should ask why before using it.
Could not get lock /var/lib/dpkg/lock-frontend
Another package operation is still running — an unattended upgrade, or a previous apt you interrupted.
Check: ps aux | grep -i apt to see whether a real process exists.
Fix: wait for it to finish. If nothing is running, remove the stale locks (sudo rm /var/lib/dpkg/lock-frontend) and run sudo dpkg --configure -a. Do not delete locks while apt is genuinely working.
No space left on device
Disk full — and it may be inodes, not bytes, especially on servers with millions of small files.
Check: df -h for space, df -i for inodes.
Fix: find the culprit with sudo du -xh / | sort -h | tail -20, then clear old logs (sudo journalctl --vacuum-time=7d) or package caches (sudo apt clean).
Killed (and nothing else)
Killed with no further explanation is almost always the OOM killer: the system ran out of memory and chose your process.
Check: dmesg | grep -i "killed process" or journalctl -k | grep -i oom.
Fix: reduce concurrency, add swap, or set a memory limit and make the program respect it. If it is a container, check the cgroup limit rather than the host.
Read-only file system
The kernel remounted the filesystem read-only after detecting errors, to prevent further damage. This is a safety behaviour, not a bug.
Check: dmesg | tail for I/O errors on the device, and mount | grep " ro,".
Fix: back up first, run fsck on the device from a rescue environment, then remount. On cloud instances, a full disk is a common trigger.
sudo: command not found
Some minimal images (containers, Alpine, Debian netinst) do not include sudo at all.
Check: id — if you are already root, you do not need it.
Fix: install it (apt install sudo as root) or use su - to switch user. In containers, running as root is often the default and sudo is unnecessary.
/bin/bash^M: bad interpreter
A script edited on Windows has CRLF line endings, so the kernel looks for an interpreter literally named bash\r.
Check: file script.sh says "with CRLF line terminators".
Fix: dos2unix script.sh, or sed -i 's/\r$//' script.sh. Configure your editor to save LF for shell scripts.
Too many open files
The per-process file descriptor limit was reached — common in servers handling many connections without closing them.
Check: ulimit -n and ls /proc/<pid>/fd | wc -l.
Fix: raise the limit in /etc/security/limits.conf for the service user, and check for a descriptor leak in the application first.
Device or resource busy
You cannot unmount or remove something that is still in use.
Check: lsof +D /mnt/point or fuser -vm /mnt/point.
Fix: close the program holding the file (or stop the service), then unmount. lsof | grep deleted explains the classic "space not freed after deleting a log" case.