Essential Linux Commands Every Ops Engineer Needs (2W+ Salary Guide)
This comprehensive guide lists the most important Linux commands for operations engineers, covering file handling, system monitoring, networking, security, scripting, and interview tips, with practical examples and explanations to boost both daily productivity and interview performance.
2W+ Salary Ops Engineer Linux Command List (Save for Reference)
As an operations engineer, mastering Linux commands is fundamental. Whether for daily maintenance or interview assessments, these commands are indispensable. This article systematically organizes essential Linux commands from a practical perspective, illustrating usage with real-world scenarios.
1. File and Directory Operations: The Basics
1.1 File Viewing Commands
# View file content
cat /etc/passwd
# Show full file content
more /var/log/messages
# Paginated view of large files
less /var/log/syslog
# Flexible pagination
head -20 /var/log/nginx.log
# Real‑time log monitoring
tail -f /var/log/apache.logInterview question: What is the difference between more and less? more can only scroll forward, while less can scroll both forward and backward. less uses less memory, suitable for large files. less supports searching (e.g., /keyword).
1.2 File Search Commands
# Advanced find usage
find /var/log -name "*.log" -mtime -7 # logs modified in last 7 days
find /home -type f -size +100M # files larger than 100 M
find /etc -name "*.conf" -exec grep -l "port" {} \; # config files containing "port"
# locate (requires updatedb)
updatedb
locate nginx.conf
# which and whereis
which python3
whereis nginx1.3 File Permission Management
# View and modify permissions
ls -la /etc/passwd
chmod 755 /usr/local/bin/script.sh
chmod u+x,g+r,o-w filename
chown nginx:nginx /var/www/html
chgrp www-data /var/log/nginx/
# Special permissions
chmod +t /tmp # sticky bit
chmod +s /usr/bin/passwd # SUID2. System Monitoring and Performance Analysis
2.1 System Resource Monitoring
# CPU and memory
top
htop
ps aux | grep nginx
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head -10
# Memory analysis
free -h
cat /proc/meminfo
vmstat 1 52.2 Disk Space Management
# Disk usage
df -h
du -sh /var/log/*
# Find largest files/directories
du -ah /home | sort -rh | head -20
# Disk I/O monitoring
iostat -x 1
iotop2.3 Network Monitoring
# Connection status
netstat -tulpn
ss -tulpn
lsof -i :80
# Traffic monitoring
iftop
nethogs
tcpdump -i eth0 port 803. Text Processing and Log Analysis
3.1 Text Processing Trio
# grep examples
grep -r "error" /var/log/
grep -i "failed" /var/log/auth.log
grep -v "INFO" /var/log/app.log | head -20
grep -E "192\.168\.1\.[0-9]+" access.log
# sed examples
sed 's/old/new/g' file.txt
sed -n '10,20p' file.txt
sed -i 's/DEBUG/INFO/g' config.conf
sed '/^#/d' config.conf
# awk examples
awk '{print $1}' /var/log/nginx/access.log
awk -F: '{print $1}' /etc/passwd
awk '$3 > 100 {print $0}' data.txt3.2 Log Analysis Practice
# Top IPs
awk '{print $1}' access.log | sort | uniq -c | sort -nr | head -10
# Count 404 errors
awk '$9 == 404 {print $0}' access.log | wc -l
# Time distribution
awk '{print $4}' access.log | cut -d: -f2 | sort | uniq -c
# Status code counts
awk '{print $9}' access.log | sort | uniq -c | sort -nr4. Process Management and Service Control
4.1 Process Management
# Kill processes
kill -9 PID
killall nginx
pkill -f "python script"
pgrep -f nginx
# Background jobs
nohup command &
jobs
bg %1
fg %14.2 System Service Management
# systemd
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl reload nginx
systemctl enable nginx
systemctl disable nginx
systemctl status nginx
# View logs
journalctl -u nginx
journalctl -f -u nginx5. Network Configuration and Troubleshooting
5.1 Network Configuration
# IP configuration
ip addr show
ip route show
ip link show
# Traditional commands
ifconfig eth0
route -n
arp -a5.2 Network Troubleshooting
# Connectivity tests
ping -c 4 google.com
traceroute google.com
mtr google.com
# Port tests
telnet 192.168.1.1 80
nc -zv 192.168.1.1 806. Compression and Backup
6.1 File Compression
# tar
tar -czf backup.tar.gz /var/www/
tar -xzf backup.tar.gz
tar -tzf backup.tar.gz
tar -czf backup-$(date +%Y%m%d).tar.gz /etc/
# zip
zip -r backup.zip /var/www/
unzip backup.zip
gzip file.txt
gunzip file.txt.gz6.2 Data Synchronization
# rsync
rsync -avz /var/www/ user@remote:/backup/
rsync -avz --delete /var/www/ /backup/
rsync -avz --exclude='*.log' /var/www/ /backup/7. System Security and User Management
7.1 User Management
# User operations
useradd -m -s /bin/bash username
usermod -aG sudo username
passwd username
userdel -r username
# View user info
id username
who
w
last7.2 System Security
# Log inspection
tail -f /var/log/auth.log
grep "Failed password" /var/log/auth.log
grep "sudo" /var/log/auth.log
# File integrity
md5sum file.txt
sha256sum file.txt8. Advanced Command Techniques
8.1 Command Pipelines
# Complex pipeline example
ps aux | grep nginx | grep -v grep | awk '{print $2}' | xargs kill -9
# Top requesting IPs
cat /var/log/nginx/access.log | grep "GET" | awk '{print $1}' | sort | uniq -c | sort -nr | head -10
# Find logs containing "error"
find /var/log -name "*.log" -exec grep -l "error" {} \; | xargs ls -la8.2 Scripting for Ops
# One‑click system info script
#!/bin/bash
echo "=== System Info ===" > system_info.txt
uname -a >> system_info.txt
echo "=== CPU Info ===" >> system_info.txt
cat /proc/cpuinfo | grep "model name" | head -1 >> system_info.txt
echo "=== Memory Info ===" >> system_info.txt
free -h >> system_info.txt
echo "=== Disk Info ===" >> system_info.txt
df -h >> system_info.txt
echo "=== Network Info ===" >> system_info.txt
ip addr show >> system_info.txt9. Common Interview Questions
9.1 Performance Tuning
Q: How to view system load?
uptime
cat /proc/loadavg
wQ: How to troubleshoot high CPU usage?
top -p PID
strace -p PID
perf top9.2 Storage Management
Q: How to find the largest files?
du -ah /var | sort -rh | head -20
find /var -type f -size +100M -exec ls -lh {} \;Q: How to monitor filesystem usage?
df -h
inotifywait -m /var/log/10. Practical Scenario Exercises
10.1 Server Fault‑Diagnosis Workflow
# Basic checks
uptime && free -h && df -h
# Process check
ps aux | head -20
top -n 1 | head -20
# Network check
netstat -tulpn | grep LISTEN
ss -tulpn
# Log check
tail -50 /var/log/messages
journalctl -xe10.2 Daily Maintenance Script
#!/bin/bash
LOG_FILE="/var/log/health_check.log"
DATE=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$DATE] Starting system health check" >> $LOG_FILE
# Disk usage warning
DISK_USAGE=$(df -h | grep -E "8[0-9]%|9[0-9]%|100%")
if [ -n "$DISK_USAGE" ]; then
echo "[$DATE] Warning: High disk usage" >> $LOG_FILE
echo "$DISK_USAGE" >> $LOG_FILE
fi
# Memory usage warning
MEM_USAGE=$(free | grep Mem | awk '{print ($3/$2) * 100.0}')
if (( $(echo "$MEM_USAGE > 90" | bc -l) )); then
echo "[$DATE] Warning: High memory usage: $MEM_USAGE%" >> $LOG_FILE
fi
# Load average warning
LOAD_AVG=$(uptime | awk -F'load average:' '{print $2}' | cut -d, -f1 | tr -d ' ')
if (( $(echo "$LOAD_AVG > 2.0" | bc -l) )); then
echo "[$DATE] Warning: High load average: $LOAD_AVG" >> $LOG_FILE
fi
echo "[$DATE] System health check completed" >> $LOG_FILEConclusion
Mastering these Linux commands will not only help you stand out in interviews but also boost efficiency in real‑world operations, enabling rapid problem identification and resolution. Remember, commands are tools; true expertise lies in understanding system principles and applying them flexibly.
As an operations engineer, you should:
Practice hands‑on in test environments.
Understand the underlying mechanisms of each command.
Combine commands to improve workflow.
Prioritize system security and adopt good operational habits.
Continuously learn new tools and technologies.
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
