git
Download a project and track changes to it. Also the easiest way to deploy a site to a server.
Syntax git clone url
git clone https://github.com/user/siteDB.gitEvery entry has a one-line summary and an example you can copy.
52 commands shown
gitDownload a project and track changes to it. Also the easiest way to deploy a site to a server.
Syntax git clone url
git clone https://github.com/user/siteDB.gitjqRead and filter JSON in the terminal. AI services return JSON, so this comes up a lot.
Syntax jq 'filter' file
curl -s https://api.github.com/repos/torvalds/linux | jq '.stargazers_count'manOpen the manual page for a command. Read it before you run something an AI suggested.
Syntax man command
man tarnvidia-smiShow the status of NVIDIA GPUs: load, memory, and running processes. Useful for AI training jobs.
Syntax nvidia-smi
watch -n 2 nvidia-smiollamaDownload and run an open-weight language model on your own machine, after Ollama is installed.
Syntax ollama run model
ollama run llama3.2pipInstall Python libraries, including the ones used for machine learning.
Syntax pip install package
pip install requestspython3 -m venvCreate an isolated Python environment so project packages do not collide. Activate it with source .venv/bin/activate.
Syntax python3 -m venv .venv
python3 -m venv .venv && source .venv/bin/activatetmuxKeep a terminal session alive after you disconnect. Good for long training or download jobs.
Syntax tmux new -s name
tmux new -s trainingcdChange the current directory. cd with no argument takes you home; cd - jumps back to the last directory.
Syntax cd [directory]
cd ~/projectscpCopy files. Use -r to copy a whole directory.
Syntax cp [-r] source destination
cp -r site/ site-backup/dfShow free and used disk space for each mounted filesystem.
Syntax df -h
df -hduShow how much disk space a file or directory uses.
Syntax du -sh path
du -sh /var/log/*findSearch for files by name, type, size, or age.
Syntax find path -name pattern
find /var/www -name '*.php'lnCreate a symbolic link (a shortcut). Nginx uses these to enable a site.
Syntax ln -s target linkname
sudo ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/lsList the files in a directory. -l shows details, -a shows hidden files, -h makes sizes readable.
Syntax ls [options] [path]
ls -lah /var/logmkdirCreate a directory. -p also creates any missing parent directories.
Syntax mkdir [-p] directory
mkdir -p site/assets/cssmvMove or rename a file or directory.
Syntax mv source destination
mv draft.txt final.txtpwdPrint the full path of the directory you are in.
Syntax pwd
pwdrmDelete files. There is no trash can, so check the path before you press Enter. -r deletes directories.
Syntax rm [-r] file
rm -ri old-project/tarBundle and compress files into one archive. Use -xzf to unpack it.
Syntax tar -czf archive.tar.gz directory
tar -czf backup.tar.gz /var/www/siteDBcurlMake a web request from the terminal. -I shows only the headers; -s hides the progress bar.
Syntax curl [options] url
curl -I https://example.comdigLook up DNS records. Handy for checking that a domain points at your server.
Syntax dig domain
dig +short example.compingCheck that another machine answers. Press Ctrl+C to stop.
Syntax ping host
ping -c 4 example.comrsyncCopy only what changed between two folders, locally or over SSH.
Syntax rsync -av source/ destination/
rsync -av public/ user@203.0.113.10:/var/www/siteDB/public/scpCopy files to or from another machine over SSH.
Syntax scp source user@host:path
scp index.html user@203.0.113.10:/tmp/ssList the ports your machine is listening on and which programs own them.
Syntax ss -tulpn
sudo ss -tulpnsshLog in to another machine securely over the network.
Syntax ssh user@host
ssh liam@203.0.113.10ufwSimple firewall front end. Allow OpenSSH before you enable it, or you can lock yourself out.
Syntax sudo ufw command
sudo ufw allow OpenSSH && sudo ufw enableaptInstall, update, and remove software on Ubuntu and Debian.
Syntax sudo apt command
sudo apt update && sudo apt install nginxjournalctlRead the logs that systemd collects. -f follows new entries.
Syntax journalctl -u service
journalctl -u nginx --since '1 hour ago'systemctlStart, stop, restart, or check a service. Use status to see if it is running.
Syntax systemctl action service
sudo systemctl status nginxadduserCreate a new user account with a home directory.
Syntax sudo adduser username
sudo adduser deploychmodChange who can read, write, or run a file. 644 is typical for web files and 755 for scripts and directories.
Syntax chmod mode file
chmod 755 deploy.shchownChange the owner and group of a file. Needed so the web server can read your site.
Syntax chown [-R] user:group path
sudo chown -R deploy:www-data /var/www/siteDBidShow a user's ID numbers and the groups they belong to.
Syntax id [user]
idsudoRun one command with administrator (root) privileges.
Syntax sudo command
sudo apt updatewhoamiPrint the name of the user you are logged in as.
Syntax whoami
whoamifreeShow how much memory and swap is used and free.
Syntax free -h
free -hkillSend a signal to a process. The default asks it to stop; -9 forces it to stop.
Syntax kill [-signal] PID
kill -9 1234psList running processes. Pipe it to grep to find one.
Syntax ps aux
ps aux | grep nginxtopLive view of CPU and memory use by process. Press q to quit.
Syntax top
topuptimeShow how long the machine has been running and its recent load.
Syntax uptime
uptimeawkPick out columns from text. $1 is the first column.
Syntax awk '{print $N}' file
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | headcatPrint the contents of a file. Also joins several files together.
Syntax cat file
cat /etc/os-releasegrepSearch inside files for lines that match a pattern. -r searches folders, -n shows line numbers, -i ignores case.
Syntax grep [options] pattern file
grep -rn 'error' /var/log/nginx/headShow the first lines of a file (10 by default).
Syntax head [-n lines] file
head -n 5 notes.txtlessRead a long file one screen at a time. Press q to quit and / to search.
Syntax less file
less /var/log/syslogsedFind and replace text in a stream or file without opening an editor.
Syntax sed 's/old/new/g' file
sed 's/http:/https:/g' links.txtsortSort lines of text. -n sorts numbers, -r reverses the order.
Syntax sort [-n] [-r] file
sort -nr counts.txttailShow the last lines of a file. -f keeps watching and prints new lines as they arrive.
Syntax tail [-f] [-n lines] file
tail -f /var/log/nginx/access.loguniqRemove repeated neighboring lines. -c counts them. Usually used after sort.
Syntax uniq [-c]
sort names.txt | uniq -cwcCount lines, words, and bytes. wc -l counts lines.
Syntax wc [-l] file
wc -l /etc/passwd