Cybersecurity-Mastery

Home › Cheatsheets › Linux Command-Line Cheatsheet

Linux Command-Line Cheatsheet

Everyday and security-relevant Linux commands in one printable page. Printable: use your browser's Print → Save as PDF.

Domain: Foundations · Last updated 2026-08-12

Quick reference

This cheatsheet is a fast recall aid, not a tutorial — learn the concepts in the Manual, then keep this beside you while you work.

CommandPurpose
pwd / cd -Print working dir / jump to previous dir
ls -laLong listing incl. hidden & permissions
find / -name '*.conf' 2>/dev/nullFind files, suppress errors
find / -perm -4000 2>/dev/nullFind SUID binaries (privesc triage)
grep -rn "password" .Recursive search with line numbers
stat fileTimestamps, inode, permissions
du -sh * / df -hDir sizes / filesystem usage

Permissions & ownership

CommandPurpose
chmod 640 filerw-r-----
chown user:group fileSet owner/group
umaskDefault permission mask
getcap -r / 2>/dev/nullFind file capabilities

Processes, services, network

CommandPurpose
ps aux --sort=-%memProcesses by memory
top / htopLive process view
systemctl status svcService state
ss -tulpnListening TCP/UDP sockets + PIDs
lsof -i :443What holds a port
ip a / ip rAddresses / routes

Users & auth (triage)

CommandPurpose
id / whoami / groupsCurrent identity
sudo -lWhat you can run as root (privesc)
cat /etc/passwd / /etc/groupAccounts / groups
last / wLogin history / who is on

Text processing

cut -d: -f1 /etc/passwd · awk -F: '{print $1}' file · sed 's/old/new/g' file · sort | uniq -c | sort -rn · tr -d '\r' · jq '.'

Cybersecurity-Mastery — interactive security learning · runs locally