You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?
Linux & Networking cheat sheet
The commands you learned, in one place.
Move around and read files
pwdShows something like /home/you/kedai.cd kedai/kitchenWalk into the kitchen inside kedai.cd ..Go up one room.cd ~Go home (a plain cd does the same).cd -Jump back to the room you were in before.lsList this room.ls -aHidden names (starting with a dot) too.ls -lOne line each: keys, owner, size, date.cat menu/today.txtShow today's menu.cat -n today.txtNumber the lines.less orders.logRead the order book page by page.head -n 3 orders.logThe first 3 orders.tail -n 3 orders.logThe 3 newest orders.tail -f orders.logKeep watching for new lines. Ctrl+C stops.mkdir recipesBuild a room called recipes.mkdir -p store/2026/novAlso make any missing parent folders.cp menu/today.txt menu/today.bakBack up today's menu.Risk: Carefulcp -r kitchen kitchen-copyCopy a folder and everything inside.Risk: Carefulmv draft.txt promo.txtRename the draft.Risk: Carefulmv *.jpg photos/Move every photo into photos.Risk: Carefulrm a.tmp b.tmpDelete two temp files.Risk: Can lose workrm -r oldDelete a folder and everything inside it.Risk: Can lose workrmdir oldDelete a folder only if it is empty.Risk: Can lose worktouch notes.txtMake an empty notes file.
Find and search
find kedai -name "*.log"Every log file in the shop.find kedai -iname "sambal*"Big or small letters, both match.find kedai -type d -emptyEmpty folders only.grep -i unpaid orders.logEvery unpaid order, any spelling.grep -c nasi-lemak orders.logCount the matching lines.grep -r belacan ~/kedaiSearch every file in every folder.grep -i unpaid orders.log | wc -lHow many unpaid orders?sort -rn counts.txtBiggest number first.cut -d" " -f3 orders.log | sort | uniq -cOrders per dish.cut -d" " -f3 orders.logJust the dish name from each order.sudo sed -i 's/lisen/listen/' /etc/nginx/sites-available/defaultFix a typo in nginx's site file.Risk: Careful
Users and permissions
idYou: uid 1000, groups you and sudo.id ainaAnother user's numbers and groups.groups ainaJust the group names.sudo systemctl restart nginxRestart the web server as root.Risk: Carefulsudo -u www-data touch uploads/a.jpgRun as another user, here the web staff.Risk: Carefulsudo -iOpen a root shell (# prompt). Type exit to leave.Risk: Carefulsudo useradd -m -s /bin/bash ainaAina, with a home folder and the bash shell.Risk: Carefulsudo usermod -aG kitchen ainaAdd Aina to the kitchen team, keeping her other teams.Risk: Carefulchmod +x open.shGive the script its run key.Risk: Carefulchmod 600 secret.txtOnly you may read and write it.Risk: Carefulchmod go-r secret.txtTake read away from group and others.Risk: Carefulsudo chown www-data:www-data uploadsGive the uploads folder to the web staff.Risk: Carefulsudo chown -R www-data:www-data uploadsThe folder and everything inside. Check the path twice.Risk: Careful
Processes, services and logs
ps auxEvery process of every user.ps aux | grep nginxOnly the nginx lines.topWatch the CPU and memory users live.pgrep -f stock-checkThe PID of the stuck stock script.kill 1241Ask process 1241 to stop.Risk: Carefulkill -9 1241Last resort: stop it at once, no tidying up.Risk: Carefulpkill -f oven-timerStop by name instead of number.Risk: Carefulsleep 300 &Start a long job in the background.jobsList them.fg %1Bring job 1 to the front.bgLet a paused job (Ctrl+Z) run on in the back.export SHOP=KancilEvery program you start can read SHOP.export PATH="$HOME/tools:$PATH"Search ~/tools first for commands.envList every exported variable.which menuWhere the menu command lives.sudo systemctl restart nginxRestart the web server with its new settings.Risk: Carefulsystemctl status nginxRunning, stopped or failed, plus the last log lines.Risk: Carefulsudo systemctl enable --now nginxStart now and at every boot.Risk: Carefulsudo journalctl -u nginx -n 20The last 20 lines from nginx.sudo journalctl -u nginx -fWatch new lines live. Ctrl+C stops.sudo journalctl -u nginx -g emergOnly lines with emerg.
Packages
sudo apt install treeInstall the tree program.Risk: Carefulsudo apt updateRefresh the shelf list first.Risk: Carefulapt show treeRead a package's label.Risk: Carefulsudo apt remove treeTake it off again.Risk: Careful
Network checks
ip -br addrOne short line per network card, with its address.ip routeThe routes. default via … is the gateway.hostname -IJust the addresses, nothing else.ss -tlnTCP ports that listen, as numbers.sudo ss -tlnpAdd the program behind each port. Needs root.sudo ss -tlnp 'sport = :80'Only port 80.getent hosts kedai.examplePrint its number, or nothing (exit 2).dig +short kedai.exampleOnly the answer: its number.dig kedai.exampleThe whole reply, with the time to live (TTL).curl -sI localhostOnly the top of the reply: status and headers.curl -v localhost/menu.htmlThe whole talk: > is what curl said, < the reply.curl -sS --connect-timeout 5 kedai.exampleGive up after 5 seconds, not about 2 minutes.openssl s_client -connect kedai.example:443 < /dev/null 2>/dev/null | openssl x509 -noout -datesWhen the ID card starts and ends.openssl x509 -noout -checkend 2592000 -in kedai.crtStill good in 30 days? Exit 0 means yes.sudo ufw allow OpenSSHLet SSH in. Always before you enable the guard.Risk: Carefulsudo ufw allow 80/tcpLet web callers in.Risk: Carefulsudo ufw enableSwitch the guard on. Over SSH, allow SSH first!Risk: Carefulsudo ufw status verboseThe list, with the default rules.Risk: Carefulping -c 3 kedai.exampleThree hellos, then a summary.traceroute kedai.exampleOne line per hop. * * * is a quiet hop.sudo apt install tracerouteNot installed by default on Debian.
Remote servers and disks
ssh you@10.0.0.5Log in to 10.0.0.5 as you.ssh kedai hostnameRun one command there, using a short name from ~/.ssh/config.ssh -G kedaiShow the settings ssh will use, without calling.ssh-keygen -t ed25519 -C "you@laptop"Make ~/.ssh/id_ed25519 and id_ed25519.pub.ssh-keygen -l -f ~/.ssh/id_ed25519.pubShow a key's fingerprint.ssh-keygen -R 10.0.0.5Forget a server's old ID card in known_hosts.ssh-copy-id you@10.0.0.5One last password, then key logins.scp menu.txt kedai:Send menu.txt to your home folder on kedai. Mind the colon.Risk: Carefulscp kedai:menu.txt .Fetch it back here.Risk: Carefulrsync -av site/ kedai:shop/Send what changed. The slash after site means its contents.Risk: Carefulrsync -av --delete --dry-run site/ kedai:shop/Show what --delete would remove, and change nothing.Risk: Carefuldf -h /Size, used, free and Use% of the main disk.df -i /File slots (inodes) instead of bytes.sudo du -sh /var/log/*One total per log folder.du -sh ~/* | sort -h | tail -n 5Your five fattest folders.
Scripts and schedules
crontab jobs.txtInstall the roster from a file. It replaces the old one.Risk: Carefulcrontab -lShow your roster.Risk: Carefulecho '0 2 * * * /home/you/backup.sh' | crontab -Install one line from the pipe.Risk: Carefulcrontab -rDelete your whole roster, without asking.Risk: Carefulsystemctl list-timers kedai-backup.timerNEXT, LEFT and the service it ACTIVATES.sudo systemctl enable --now kedai-backup.timerSwitch a timer on, now and at every boot.systemd-analyze calendar '*-*-* 02:00:00'When does this time rule fire next?set -euo pipefailPut it right under #!/bin/bash.cmd || trueAllow one failure on purpose.