Essential Linux Command Cheat Sheet for Operations Engineers
This guide compiles essential Linux command‑line techniques—from searching and editing with vi/vim, using pipelines, file finding, string replacement, redirection, permission changes, to monitoring system resources and network connections—helping operations engineers boost productivity and maintain high service availability.
Operations engineers (also called DevOps or SRE) are responsible for keeping services highly available, optimizing architecture, and improving deployment efficiency.
1. Search in vi/vim
Use /pattern to search; press Enter to jump to the first match, then n for the next occurrence.
2. Undo and fix garbled text in vim
Press Esc then u to undo the last change.
To view a file in binary mode, run vim -b mytest.php.
3. Pipe operator ( | )
Pass the output of one command to another. Example: cat install.log | more displays the log page‑by‑page.
Combine with grep for filtering, e.g., cat -n hello.txt | grep "hello" shows only lines containing "hello".
4. Find files or directories
Examples:
find /home -name "hello*" find / -name "h?m*" find / -size +1000000k5. String replacement in vim
Basic forms:
:s/well/good/ " replace first occurrence on the line :s/well/good/g " replace all occurrences on the line :%s/well/good/g " replace all occurrences in the whole fileUse # as an alternate delimiter to avoid escaping slashes, e.g., :s#well/#good/#.
6. Redirection
Overwrite: ls -l /etc > /home/myback.txt Append:
ls -l /etc >> /home/myback.txt7. Delete multiple lines
Show line numbers with :set nu, then delete a range, e.g., 190,6233d.
8. Jump to a specific line
Use G to go to the last line, 1G for the first line, or 17G for line 17.
9. Copy lines
Copy one line: yy, paste with p.
Copy multiple lines: 7yy copies seven lines starting from the current line.
10. Check Python version
python -Vor
python --version11. grep usage
Show n lines after a match: grep -A n Show n lines before a match: grep -B n Show n lines of context: grep -C n Ignore case:
grep -i pattern12. ll or ls details
ll -htshows human‑readable sizes sorted by time.
13. Find which process uses a file
lsof filename14. Create and view users
Create a user: useradd redis and set password with passwd redis.
On Ubuntu: useradd openstack -m -s /bin/bash and delete with userdel -r openstack.
View groups in /etc/group, users in /etc/passwd and /etc/shadow.
15. Check memory usage
free -mshows memory in megabytes.
16. Disk usage
df -lhdisplays disk usage in a human‑readable format.
17. CPU information
cat /proc/cpuinfolists each CPU core; cat /proc/cpuinfo | grep "model name" | wc -l counts cores.
18. Check which port is listening
netstat -nlap | grep -i est | grep -i 6379 | awk '{print $4}'19. Synchronize server time
ntpdate pool.ntp.org(can be scheduled with 1 */2 * * * ntpdate pool.ntp.org).
20. Restrict SSH login
Edit /etc/ssh/sshd_config and add AllowUsers solr, then reload with service sshd reload.
21. Common JDK environment variables
JAVA_HOME=/usr/java/jdk1.7.0_55
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH22. Check Redis/Tomcat versions
Redis: redis-cli info | grep 'redis_version' Tomcat: run ./version.sh inside the bin directory.
23. Verify if firewall blocks port 80
iptables -vnL | grep ":80 "– output indicates the port is open.
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.
