Complete reference for the most useful terminal commands
mkdir name | Create a directory |
touch file | Create empty file |
cp file new | Copy file |
cp -r dir newdir | Copy directory recursively |
mv file dir/ | Move file to directory |
mv old new | Rename file/directory |
mv -i file dir/ | Move with confirmation |
rm file | Delete file (no undo!) |
rm -r dir | Delete directory + contents |
rm -i file | Delete with confirmation |
rmdir empty-folder | Delete an empty directory |
cat file | Display entire file |
less file | View with pagination (q to quit) |
head file | Show first 10 lines |
tail file | Show last 10 lines |
tail -f file | Watch file in real-time |
nano file | Open a simple text editor |
wc -l file | Count the lines in a file |
find . -name "*.txt" | Find all .txt files |
find . -name "*report*" | Find files with "report" in name |
find . -type d | Find all directories |
find . -size +1M | Find files larger than 1MB |
grep "word" file | Search for text in file |
grep -r "word" dir/ | Search recursively in directory |
grep -i "word" file | Case-insensitive search |
grep -n "word" file | Show line numbers |
| Command | What It Does |
|---|---|
sudo apt update | Refresh the package list before installing things |
sudo apt upgrade | Install available updates |
sudo apt install package | Install a program |
sudo apt remove package | Uninstall a program |
sudo apt autoremove | Clean up packages you no longer need |
apt search package | Search for a package by name |
apt show package | See details about a package |
| Command | What It Does |
|---|---|
date | Show current date and time |
cal | Show calendar |
whoami | Show current username |
uname -a | Show system information |
df -h | Show disk space (human readable) |
du -sh */ | Show directory sizes |
free -h | Show memory and swap usage |
top | Live view of running processes |
htop | Interactive process viewer |
ps aux | List running processes |
uptime | Show how long the machine has been running |
lsb_release -a | Show Ubuntu version details |
history | Show command history |
man command | Show manual for command |
command --help | Quick help for command |
ip a | Show IP addresses and network interfaces |
ping host | Test whether you can reach a host |
curl url | Fetch a web page or API response |
wget url | Download a file from the web |
ssh user@host | Connect to another machine |
scp file user@host:/path | Copy a file to another machine |
which program | Show where a command lives |
nslookup domain | Look up a domain's IP address |
- = Regular filed = Directoryl = Linkr = Readw = Writex = Execute- = No permission| Command | Description |
|---|---|
chmod +x file | Make file executable |
chmod 755 file | Owner: rwx, Group: r-x, Others: r-x |
chmod 644 file | Owner: rw-, Group: r--, Others: r-- |
chown user file | Change file owner |
Tab | Auto-complete a command or filename |
Ctrl + C | Stop the current command |
Ctrl + L | Clear the screen |
Ctrl + R | Search command history |
↑ / ↓ | Scroll through previous commands |
cmd | less | Scroll through long output |
cmd | grep word | Filter output for a word |
cmd > file | Save output to a file |
cmd >> file | Append output to a file |
cmd1 && cmd2 | Run the second command only if the first succeeds |
pwd — Where am I?ls — List filescd dir — Change directorycd .. — Go upcd ~ — Homemkdir — Create foldertouch — Create filecp — Copymv — Move/Renamerm — Deletecat — Show fileless — Page throughhead — First 10 linestail — Last 10 linesgrep — SearchStuck on a command? Not sure what to do next? The fastest way to get unstuck is to ask Claude. Just describe what you're trying to do or paste the error.
No shame in asking. Claude can see your screen, understand context, and give you the exact command you need.