45 Must‑Know Linux Command Combos for Everyday Ops – Boost Efficiency
This guide compiles 45 essential Linux command combinations, organized into seven high‑frequency operational scenarios—file handling, find‑based searches, system monitoring, log analysis, text processing, network capture, and disk cleanup—providing a near‑complete toolbox that addresses roughly 99% of everyday sysadmin tasks.
This article summarizes 45 frequently used and highly efficient Linux commands, covering file operations, search and cleanup, system monitoring, log analysis, text processing, network capture, and disk cleanup, which together address about 99% of daily operations needs.
1. Batch File Operations
Batch creation: touch haodao{1..100}.py Generate large file 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 & Cleanup
Search by name, type, permission, size, or time.
Examples:
By suffix: find . -name "*.py" By permission: find . -type f -perm 777 By size range: find . -size +100M -size -1G By time + name for cleanup:
find . -mtime +7 -name "*.py" | xargs rm -rf3. System Resource Monitoring
View CPU model and core count: cat /proc/cpuinfo | grep name | uniq -c Top 20 memory/CPU consuming processes:
Memory: ps aux | sort -rnk 4 | head -20 CPU: ps aux | sort -rnk 3 | head -20 Run command in background:
nohup cmd > /dev/null 2>&1 &4. Log and Access Analysis
Tomcat log analysis examples:
Count IPs in a time window: awk '{print $4,$1}' access.log | grep "11/Dec/2022:09" Top 20 IPs by request frequency:
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 strings: sed -i 's/haodao/HAODAO/g' file.py Replace paths: sed -i 's:/etc/dhcp:/home:g' file.py Other tricks: add/remove content at line start/end, delete comments, insert before/after specific lines, etc.
6. Network Capture and Port Analysis
Precise packet capture with tcpdump:
Specific port: tcpdump -i ens33 port 8080 -n IP range: tcpdump portrange 80-443 -i ens33 -n ICMP from 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 | tail One‑sentence summary: 45 command combos form a full‑stack ops toolbox covering file handling, system monitoring, log analysis, network troubleshooting, text processing, and disk cleanup, solving almost all daily Linux administration scenarios.
Linux Cloud Computing Practice
Welcome to Linux Cloud Computing Practice. We offer high-quality articles on Linux, cloud computing, DevOps, networking and related topics. Dive in and start your Linux cloud computing journey!
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.
