Show Menu
Cheatography

Linux Commands Cheat Sheet by

The essential Linux commands for files, permissions, networking, processes, and package management — with syntax and the flags you'll actually use. Handy for CompTIA Linux+ prep, sysadmin work, and daily terminal life. More free study resources at bytebarhq.com.

Navigation & Files

pwd
Print working directory
ls -la
List all files incl. hidden, with details
cd -
Jump back to previous directory
cp -r src dst
Copy recurs­ively
mv old new
Move / rename
rm -rf dir
Delete recurs­ively, no prompt (⚠️ careful)
mkdir -p a/b/c
Create nested direct­ories
touch file
Create empty file / update timestamp
find / -name "­*.l­og"
Search by name
grep -r "­err­or" /var/log
Search inside files, recursive
cat / less / head / tail
View files (
tail -f
follows live)
The 40+ commands CompTIA Linux+, Security+, and every sysadmin interview expect.

Permis­sions

ls -l
Show permis­sions (
-rwxr-xr--
)
chmod 755 file
rwx / r-x / r-x — standard for scripts
chmod 644 file
rw- / r-- / r-- — standard for files
chown user:group file
Change owner
sudo !!
Re-run last command as root
Numeric recap: 4 = read, 2 = write, 1 = execute → 7 = rwx, 6 = rw-, 5 = r-x, 4 = r--

Networking

ip a
Show interfaces + IPs (modern
ifconfig
)
ip r
Show routing table
ping -c 4 host
Test connec­tivity
ss -tulpn
Listening ports + processes (modern
netstat
)
curl -I host
Fetch headers
dig +short exampl­e.com
DNS lookup
traceroute host
Path packets take
ssh user@host
Secure remote shell
scp file user@h­ost­:/path
Secure copy
Modern replac­ements:
ip
for
ifconfig
,
ss
for
netstat
.

System & Processes

ps aux | grep nginx
Find processes
top
/
htop
Live process monitor
kill -9 PID
Force-kill a process
systemctl status nginx
Service status
systemctl restart nginx
Restart a service
journalctl -u nginx -f
Follow service logs
df -h
Disk space (human­-re­adable)
du -sh *
Directory sizes
free -h
Memory usage
uptime
Load + uptime
uname -a
Kernel / system info
-h
means human-­rea­dable — use it for df, du, free.

Text Power Tools

grep -i "­fai­l" log
Case-i­nse­nsitive search
sort file | uniq -c
Count unique lines
awk '{print $1}' file
Print column 1
sed 's/old­/new/g' file
Find and replace
wc -l file
Count lines
history | grep ssh
Search command history
Chain them with pipes — that's where the power is.
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Pocket Guide LINUX commands Cheat Sheet
          Linux System Administration Cheat Sheet
          Command Line and Terminal navigation Cheat Sheet

          More Cheat Sheets by bytebar

          Common Network Ports Cheat Sheet
          OSI Model Cheat Sheet