Linux Commands Cheatsheet | Common Terminal Commands

Linux Commands Cheatsheet

In-depth Linux command reference for files, process, logs, network, disk, and incident debugging.

58/58 commands
TerminalAll Developers

This Linux cheatsheet is designed for real developer workflows, from daily navigation to production incident debugging on servers.

Filesystem and Navigation

List files
ls -lah
Change directory
cd <path>
Current directory
pwd
Tree view (if installed)
tree -L 2
Create nested directory
mkdir -p <path/to/dir>
Copy recursively
cp -r <source> <destination>
Move or rename
mv <source> <destination>
Remove file/folder safely
rm -rf <path>

Find, Search, and Text Processing

Find file by name
find . -name '<filename>'
Find by extension and size
find . -type f -name "*.log" -size +100M
Find and delete old files
find /tmp -type f -mtime +7 -delete
Count lines
wc -l <file>
Show first and last lines
head -n 20 <file> && tail -n 20 <file>
Sort and unique count
cat <file> | sort | uniq -c | sort -nr | head

Permissions and Ownership

Change mode
chmod 755 <file-or-dir>
Change owner
chown <user>:<group> <file-or-dir>
Recursive ownership update
chown -R <user>:<group> <directory>
Add executable permission
chmod +x <script.sh>
Set SGID on directory
chmod 2775 <shared-dir>
Default ACL for shared directory
setfacl -R -m d:g:<group>:rwx <dir>

Process and Service Management

Show running processes
ps aux | head
Process tree
ps -ef --forest | less
Monitor processes interactively
top
Monitor with better UI (if installed)
htop
Find process by name
pgrep -af <process-name>
Kill process
kill -9 <pid>
Check systemd status
systemctl status <service>
Restart service
sudo systemctl restart <service>

Networking and Ports

Check listening ports
ss -tulpn
Port ownership details
lsof -i :<port>
DNS lookup
dig <domain> +short
Route and interface info
ip addr && ip route
Quick connectivity test
curl -I https://<host>
HTTP timing breakdown
curl -o /dev/null -s -w "dns=%{time_namelookup} connect=%{time_connect} ttfb=%{time_starttransfer} total=%{time_total}\n" https://<host>

Logs and Runtime Debugging

Follow file logs
tail -f /var/log/<file>.log
Show recent system logs
journalctl -xe
Follow service logs
journalctl -u <service> -f
Logs from last 1 hour
journalctl -u <service> --since "1 hour ago"
Error-focused service logs
journalctl -u <service> -n 500 | grep -Ei "error|fatal|panic|exception"
Kernel warnings
dmesg -T | tail -n 50

Disk, Memory, and Resource Usage

Filesystem usage
df -h
Directory size summary
du -sh * | sort -h
Top largest directories
du -xhd1 / | sort -h | tail -n 20
Memory usage
free -h
CPU and memory by process
ps aux --sort=-%mem | head -n 15
I/O stats (if installed)
iostat -xz 1 5

Archive, Compression, and Transfer

Create tar.gz
tar -czf archive.tar.gz <folder>
Extract tar.gz
tar -xzf archive.tar.gz
Create zip recursively
zip -r archive.zip <folder>
Sync folders with rsync
rsync -avh --delete <src>/ <dest>/
Copy over SSH
scp <file> user@host:/path/
Resume download
curl -L -C - -o <file> <url>

Practical Incident One-Liners

Top memory consumers
ps aux --sort=-%mem | head -n 20
Top CPU consumers
ps aux --sort=-%cpu | head -n 20
Find deleted-but-open files
lsof +L1
Who logged in recently
last -a | head
Recent failed SSH logins
grep "Failed password" /var/log/auth.log | tail -n 50
Check if app port is reachable
nc -zv 127.0.0.1 <port>

What Is Linux Commands Cheatsheet?

This Linux cheatsheet is designed for real developer workflows, from daily navigation to production incident debugging on servers.

Filesystem and permission command patterns

Process, service, and networking diagnostics

Log analysis, disk usage, and recovery helpers

Key Features of Linux Commands Cheatsheet

Filesystem and permission command patterns

Process, service, and networking diagnostics

Log analysis, disk usage, and recovery helpers

How to Use Linux Commands Cheatsheet

Step 1

Start with filesystem and process commands for day-to-day development tasks

Step 2

Use networking and logs sections during incidents

Step 3

Use disk, archive, and one-liner sections for maintenance and cleanup

Still need help?

Need a hand with Linux Commands Cheatsheet? Reach out through support or send a feature request with your workflow.

Contact support