Linux Commands Cheat Sheet (Cybersecurity
Focus)
Basic Commands
pwd → Show current directory path
ls, ls -l, ls -a → List files and directories
cd → Change directory
touch file.txt → Create empty file
mkdir folder → Create directory
cp file1 file2 → Copy files
mv file1 file2 → Move or rename
rm file.txt → Remove file
cat file.txt → Display file content
nano file.txt / vim file.txt → Edit file
User & Permissions
whoami → Show current user
id → Show user ID and group info
adduser username → Add new user
passwd username → Change password
chmod 755 file.sh → Change permissions
chown user:group file.txt → Change ownership
sudo → Run as root/admin
System & Process Monitoring
uname -a → System info
top → Show running processes
ps aux → List processes
kill → Kill process by ID
df -h → Show disk usage
du -sh folder/ → Show folder size
free -m → Show memory usage
uptime → Show system running time
Networking
ifconfig / ip a → Show network interfaces
ping → Test connectivity
netstat -tulnp / ss -tuln → Show open ports & processes
curl http://site.com → Fetch webpage
wget URL → Download file
scp file user@host:/path → Secure copy to remote
ssh user@host → Remote login
traceroute host → Show packet path
nslookup domain.com → DNS lookup
File Search & Management
find / -name file.txt → Find file by name
locate file.txt → Quickly search (needs updatedb)
grep 'text' file.txt → Search inside file
grep -r 'keyword' /etc/ → Recursive search
Package Management
apt update && apt upgrade → Update system (Debian/Ubuntu)
apt install package → Install package (Debian/Ubuntu)
yum install package / dnf install package → Install package (RHEL/CentOS)
Security & Logs
sudo ufw enable → Enable firewall (Ubuntu)
sudo ufw status → Check firewall rules
iptables -L → Show firewall rules
history → Show command history
last → Show login history
who → Show who is logged in