Operations 12 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Essential Linux Command Cheat Sheet for Operations Engineers

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 +1000000k

5. 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 file

Use # 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.txt

7. 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 -V

or

python --version

11. 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 pattern

12. ll or ls details

ll -ht

shows human‑readable sizes sorted by time.

13. Find which process uses a file

lsof filename

14. 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 -m

shows memory in megabytes.

16. Disk usage

df -lh

displays disk usage in a human‑readable format.

17. CPU information

cat /proc/cpuinfo

lists 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 PATH

22. 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperationsLinuxVimsystem-monitoring
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.