45 Essential Linux Commands Every Sysadmin Should Master
This guide aggregates 45 high‑frequency Linux command combos across seven core operational scenarios—file handling, advanced find/cleanup, system monitoring, log and access analysis, network packet capture, text processing, and disk cleanup—to cover roughly 99% of everyday sysadmin tasks.
Compiled in a "command combo + real‑world scenario" format, this cheat sheet lists the 45 most commonly used and efficient Linux commands for daily operations, covering file manipulation, search and cleanup, system monitoring, network troubleshooting, log analysis, text processing, and disk cleanup, which together address about 99% of typical sysadmin needs.
1. Batch File Operations
Batch create files: touch haodao{1..100}.py Generate large files quickly: dd if=/dev/zero of=test.txt bs=1M count=1024 Five ways to empty a file: > file, truncate -s 0 file, cat /dev/null > file, etc.
2. Advanced find Search and Cleanup
Search by name, type, permissions, size, or time: find . -name "*.py" (by suffix) find . -type f -perm 777 (by permission) find . -size +100M -size -1G (by size range) find . -mtime +7 -name "*.py" | xargs rm -rf (by time + name for cleanup)
3. System Resource Monitoring
View CPU model and core count: cat /proc/cpuinfo | grep name | uniq -c Top 20 processes by memory usage: ps aux | sort -rnk 4 | head -20 Top 20 processes by CPU usage: ps aux | sort -rnk 3 | head -20 Run commands in background:
nohup cmd > /dev/null 2>&1 &4. Log and Access Analysis
Tomcat log analysis examples
Count unique IPs in a time window: awk '{print $4,$1}' access.log | grep "11/Dec/2022:09" Top 20 visiting IPs:
awk '{print $1}' access.log | sort | uniq -c | sort -nr | head -20Pages visited by a specific IP:
grep ^IP access.log | awk '{print $7}'5. Text Processing with sed
Replace a string: sed -i 's/haodao/HAODAO/g' file.py Replace a path: sed -i 's:/etc/dhcp:/home:g' file.py Various tricks: add content at line start/end, delete comments, insert before/after specific lines, etc.
6. Network Capture and Port Analysis
Precise packet capture with tcpdump:
Capture a specific port: tcpdump -i ens33 port 8080 -n Capture a range of ports: tcpdump portrange 80-443 -i ens33 -n Capture ICMP from a source IP: tcpdump icmp and src 192.168.20.231 -i ens33 -n Top IPs connecting to a port:
netstat -anlp | grep 80 | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -157. Disk and Directory Cleanup
Identify large files in /var: du -xBM --max-depth=2 /var | sort -rn | head -20 Top 10 large files in current directory:
du -s * | sort -n | tailOne‑Sentence Summary
These 45 command combos form a full‑stack operations toolbox—covering file handling, system monitoring, log analysis, network troubleshooting, text processing, and disk cleanup—that can solve roughly 99% of everyday Linux sysadmin scenarios, and are worth bookmarking and mastering.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
