Everything you need at the terminal, in one place
Searchable, copy-pasteable commands for daily Linux/Bash work — filesystem basics through SSH, systemctl, WSL2 and networking. Type in the search bar or jump via the sidebar. Click any code block to copy it.
Permissions & Ownership
chmod, chown, sudo
midLock down SSH key perms
SSH refuses to use keys with overly-open permissions — this is the fix for "Permission Denied (publickey)".
easyMake a script executable
Add the execute bit so you can run it with ./script.sh.
midchown
Change the owning user and group of a file.
midOctal permission cheat
read=4, write=2, execute=1 — sum per owner/group/other. 755 = rwxr-xr-x.
Package Management (apt)
Debian / Ubuntu
easyUpdate & upgrade
Refresh the package index, then upgrade installed packages.
easyInstall / remove
Install or uninstall a package by name.
midPi-hole update
Update Pi-hole itself, or force a manual ad-list refresh.
Text Processing & Search
grep, sed, awk and friends
midgrep
Search for text in a file, or recursively through a directory.
advsed
Stream-edit a file: find and replace text.
advawk
Extract a column of data from structured text output.
midsort / uniq / wc
Sort lines, drop adjacent duplicates, and count lines.
advWhat's listening?
See which processes are bound to which ports. ss is the modern, always-installed alternative.
Bash Scripting
Variables, conditionals, loops, redirection
easyFirst script
The shebang line tells the OS which interpreter to run.
advStrict mode
Abort on error, on unset variables, and on a failure anywhere in a pipeline. Put it under the shebang of every real script.
Note: without it, a failing command mid-script keeps going and can do real damage.
easyVariables
No spaces around =. Use braces to disambiguate.
midif / elif / else
Branch on an argument or condition.
midLoops
for iterates a list; while runs until its condition is false.
midRedirection & pipes
Send output to files or chain commands together.
advAuto-reconnect loop
A resilient SSH session that reconnects on drop — from real usage notes.
midRun detached
Keep a process alive after you close the terminal.
advCron scheduling
Run a script automatically on a schedule.
Processes & systemctl
Managing services like SSH
midView & kill processes
List running processes and stop one by PID.
midsystemctl basics
Start, stop, restart, or check status of any service (e.g. ssh).
advEnable on boot
Crucial: makes a service start automatically every boot.
midmacOS equivalent
launchctl is macOS's version of systemctl for checking services.
Networking
Static IPs, connectivity, Tailscale
easyCheck connectivity
Show interfaces/IPs, routing table, and test a connection.
advFind connection name
Step 1 before setting a static IP with nmcli.
advSet a static IP
Configure a fixed IP, gateway, and DNS via NetworkManager.
Then: sudo nmcli connection down/up preconfigured or sudo reboot
midChange hostname
Rename the machine on the network.
midTailscale status
Check your mesh VPN connection and MagicDNS IP.
advTailscale fixes
Force reauth, or fix a Pi reporting "Internet Down".
SSH
Keys, config, and troubleshooting
midGenerate a key
-N "" skips the passphrase for a passwordless key.
midCopy key to remote
Enable passwordless login to a Linux/WSL machine.
adv~/.ssh/config
Turn `ssh user@ip -p 2222` into just `ssh myhost`.
midCopy files over SSH
scp for one-off copies; rsync resumes and only sends what changed. Note scp uses -P for port, rsync passes it through -e.
Careful: a trailing slash on the rsync source copies the contents, not the folder itself.
midFix "host identification changed"
Clear a stale fingerprint after a server was rebuilt.
advFix "Permission Denied"
Almost always a permissions problem on the key files.
advWindows SSH (PowerShell)
Check/start the service and open a firewall port.
WSL2
Windows Subsystem for Linux config
advStable .wslconfig
Place at C:\Users\<you>\.wslconfig — keeps SSH reachable and WSL awake.
Apply with wsl --shutdown, then restart WSL.
midEnable SSH in WSL
Fixes ssh.service showing "inactive (dead)".
advAuto-mount Windows folders
Edit /etc/wsl.conf so C:\ and D:\ mount cleanly with correct permissions.
midSymlink a Windows folder
Bring a Windows folder into your Linux home directory.
Quick-Reference Tables
Cross-platform SSH & systemctl at a glance
| Goal | Linux / Mac | Windows (PowerShell) |
|---|---|---|
| Check SSH service | systemctl status ssh | Get-Service sshd |
| Start SSH service | sudo systemctl start ssh | Start-Service sshd |
| Restart SSH service | sudo systemctl restart ssh | Restart-Service sshd |
| Enable SSH on boot | sudo systemctl enable ssh | Set-Service sshd -StartupType Automatic |
| Generate SSH key | ssh-keygen -t ed25519 | ssh-keygen -t ed25519 |
| Copy key to remote | ssh-copy-id user@host | manual Add-Content to authorized_keys |
| Open firewall port | sudo ufw allow 2200/tcp | New-NetFirewallRule ... |
| Task | Command | Description |
|---|---|---|
| Start the service | sudo systemctl start sshd | Starts the SSH daemon, allowing connections immediately. |
| Stop the service | sudo systemctl stop sshd | Immediately shuts down the SSH daemon, disconnecting all users. |
| Restart the service | sudo systemctl restart sshd | Stops then starts. Use after editing /etc/ssh/sshd_config. |
| Check status | sudo systemctl status sshd | Shows running/failed state, PID, and last log lines. |
| Enable on boot | sudo systemctl enable sshd | Crucial — service auto-starts every boot. |
| Disable on boot | sudo systemctl disable sshd | Prevents auto-start on boot. |
Terminal Playground
A tiny fake shell to practice a handful of commands (runs entirely in your browser)