logo
search
list

Table of Content

Help (Always First)
Navigation
Files and Directories
Search
Permissions and Users
Packages (APT + Snap)
Processes and Services
Disk, Memory, System Info
Network
Archives
Pipes, Redirects, Chaining
Shell History and Aliases
Copy-Paste One-Liners
Keyboard / Terminal Survival Keys
After the Terminal: Documents on Linux
FAQ

Linux Commands Cheat Sheet (Ubuntu Quick Reference)

Posted by Algirdas Jasaitis

calendar

2026-07-24

views

872

likes

4

A Linux commands cheat sheet is a quick-reference list of terminal commands you reuse every day—navigate folders, copy files, install packages, and manage services—without re-learning flags from scratch. On Ubuntu, open Terminal, type a command, press Enter, and use man command or command --help for details (Ubuntu’s official CLI cheat sheet follows the same idea).

This page is built as a dense table reference (Bash on Ubuntu/Debian-family). It complements longer tutorials: scan a section, copy a line, then check man before anything destructive.

Jump to: navigation · files · search · permissions · apt · processes · network · pipes · history/aliases · one-liners

Concept illustration of a Linux commands cheat sheet next to a terminal window
Scan the tables, copy a command, then check man or --help before running anything destructive.

Help (Always First)

CommandMeaning
man cmdFull manual (q quit)
man -k keywordSearch man descriptions
cmd --helpShort usage
whatis cmdOne-line summary
which cmdPath to executable
type cmdAlias, builtin, or binary?

Navigation

CommandMeaning
pwdPrint working directory
lsList files
ls -lLong list (perms, owner, size)
ls -aInclude hidden (.file)
ls -laLong + hidden
ls -lhHuman-readable sizes
cd dirChange directory
cd ..Up one level
cd ~ / cdHome
cd -Previous directory
cd /Root
treeDirectory tree (if installed)
tree -L 2Tree depth 2

Files and Directories

CommandMeaning
mkdir nameMake directory
mkdir -p a/b/cMake nested dirs
rmdir nameRemove empty directory
touch fileCreate empty / update time
cp src destCopy file
cp -a src/ dest/Recursive copy, keep attrs
mv old newMove / rename
rm fileDelete file
rm -r dir/Delete directory tree
rm -i filePrompt before delete
cat filePrint file
less filePage viewer
head -n 20 fileFirst 20 lines
tail -n 20 fileLast 20 lines
tail -f logFollow log
wc -l fileCount lines
file pathGuess file type
ln -s target linkSymbolic link

Danger zone: avoid rm -rf / and unquoted globs as root.

Search

CommandMeaning
grep pattern fileMatch lines in a file
grep -R pattern dir/Recursive search (Ask Ubuntu classic)
grep -Ri pattern dir/Case-insensitive recursive
grep -n pattern fileShow line numbers
find . -name "*.pdf"Find by name
find . -mtime -1Modified last day
find . -type f -emptyEmpty files
locate nameFast DB search (if mlocate installed)

Permissions and Users

CommandMeaning
sudo cmdRun as admin
sudo -iRoot shell
whoamiCurrent user
idUID/GIDs
chmod 644 filerw-r--r--
chmod u+x scriptAdd execute for owner
chmod -R u+rwX dir/Recursive (careful)
chown user:group fileChange owner
umaskDefault permission mask
passwdChange your password
groupsYour groups

chmod vs chown (Ask Ubuntu): chmod = can they access it?; chown = who owns it?

Packages (APT + Snap)

CommandMeaning
sudo apt updateRefresh indexes
sudo apt upgradeUpgrade packages
apt search kwSearch packages
apt show pkgPackage info
sudo apt install pkgInstall
sudo apt remove pkgRemove (keep configs)
sudo apt purge pkgRemove + configs
sudo apt autoremoveDrop unused deps
apt list --installedInstalled packages
sudo snap install pkgSnap install
snap listInstalled snaps
sudo snap refreshUpdate snaps

Processes and Services

CommandMeaning
ps auxProcess snapshot
top / htopLive monitor
kill PIDTerminate
kill -9 PIDForce kill
pkill nameKill by name
systemctl status svcService status
sudo systemctl start svcStart
sudo systemctl stop svcStop
sudo systemctl restart svcRestart
sudo systemctl enable svcEnable at boot
systemctl list-unit-files --state=enabledEnabled units
journalctl -u svc -fFollow service logs

Disk, Memory, System Info

CommandMeaning
df -hDisk free (human)
du -sh *Folder sizes here
du -sh .Current dir size
free -hRAM / swap
uname -aKernel info
hostnamectlHost / OS info
uptimeLoad / uptime
lsblkBlock devices
lscpuCPU info

Network

CommandMeaning
ip aAddresses / interfaces
ip rRoutes
ping -c 4 hostConnectivity test
curl -I URLHTTP headers
wget URLDownload
ssh user@hostRemote shell
scp file user@host:pathCopy over SSH
ss -tulpnListening sockets
sudo ufw statusFirewall status (if UFW)

Archives

CommandMeaning
tar -xzf a.tar.gzExtract gzip tarball
tar -czf a.tar.gz dir/Create gzip tarball
tar -tzf a.tar.gzList contents
tar -xJf a.tar.xzExtract xz tarball
zip -r a.zip dir/Zip folder
unzip a.zipUnzip

Pipes, Redirects, Chaining

From Ubuntu’s CLI-in-depth / cheat sheet:

SyntaxMeaning
cmd > fileOverwrite stdout to file
cmd >> fileAppend stdout
cmd < fileFile as stdin
cmd 2> err.txtRedirect stderr
cmd > out 2>&1Stdout+stderr to file
cmd > /dev/nullDiscard stdout
a | bPipe a → b
a && bb if a succeeds
a || bb if a fails
a ; bRun both
cmd &Background
$(cmd)Command substitution
$((1+2))Arithmetic

Ask Ubuntu preference: use && in install scripts so later steps stop after failure.

Shell History and Aliases

High-traffic Ask Ubuntu topics:

CommandMeaning
historyShow command history
history | grep aptSearch history
!!Re-run last command
sudo !!Re-run last with sudo
Ctrl+RReverse history search
alias ll='ls -la'Temporary alias
aliasList aliases
type aliasnameSee what an alias runs

Permanent alias (Ask Ubuntu pattern): add alias ll='ls -la' to ~/.bashrc, then source ~/.bashrc.

Copy-Paste One-Liners

# Update system
sudo apt update && sudo apt upgrade -y

# Biggest folders in /
sudo du -xh / --max-depth=1 | sort -h

# Find large files (>100M)
find ~ -type f -size +100M -ls

# Recycle-safe delete prompt
alias rm='rm -i'

# Extract then enter
tar -xzf project.tar.gz && cd project

# Follow auth log
sudo journalctl -u ssh -f

# Backup home (example)
rsync -a --progress ~/Documents/ /media/usb/Documents/

rsync notes from Ask Ubuntu: use --delete only when you intend destination to mirror source; exclude paths with --exclude.

Keyboard / Terminal Survival Keys

KeysAction
TabAutocomplete
Ctrl+CCancel command
Ctrl+DEOF / exit shell
Ctrl+LClear screen
Ctrl+RHistory search
Ctrl+ZSuspend job (fg to resume)
resetFix broken terminal (Ask Ubuntu “typed text invisible”)

After the Terminal: Documents on Linux

When you need formatted DOCX/XLSX/PDF instead of plain text, install WPS Office for Linux from the official WPS Linux download page. Keep this cheat sheet for system tasks; use WPS for Microsoft Office–compatible files.

FAQ

Is this the same as Ubuntu’s official cheat sheet?
It follows the same structure and commands as Canonical’s command-line cheat sheet, expanded with apt, systemctl, network, archives, and Ask Ubuntu–common one-liners.

How do I print a Linux commands cheat sheet?
Open this page and print, or copy each table into a doc. For a local copy: man pages stay authoritative when flags change.

What should I memorize first?
pwd, ls, cd, cp, mv, rm -i, mkdir, grep, find, sudo apt update, man.

How do I extract .tar.gz?
tar -xzf file.tar.gz

Where do permanent aliases go?
Usually ~/.bashrc on Ubuntu Bash, then source ~/.bashrc.

Command not found—what next?
apt search name, install the package, or check echo $PATH / typos with which/type.

Algirdas Jasaitis

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.