Essential Linux Commands Every Operations Engineer Should Master
This guide compiles the most frequently used Linux commands for file navigation, content viewing, searching, permission handling, text processing, archiving, system control, and process management, providing clear examples that help operations staff work more efficiently and confidently.
As an operations professional, mastering these common Linux commands can dramatically improve work efficiency.
1. Files and Directories
cd – change directory
cd /home # enter /home directory
cd .. # go up one level
cd ../.. # go up two levels
cd # go to home directory
cd ~user1 # go to user1's home
cd - # return to previous directorypwd – display current path
# pwd
/rootls – list files and directories
ls # list names
ls -l # detailed list
ls -a # include hidden files
ls -R # recursive list
ls [0-9] # names containing digitscp – copy files
-a copy attributes
-p preserve attributes (useful for backup)
-i prompt before overwrite
-r recursive copy (directories)
-u copy only when source is newermv – move or rename files
-f force overwrite
-i prompt before overwrite
-u overwrite only if source is newerrm – remove files or directories
-f ignore nonexistent files
-i interactive prompt
-r recursive delete (dangerous for directories)2. Viewing File Contents
cat, tac, more, head, tail and their options
cat file1 # view from start
tac file1 # view from end
cat -n file1 # show line numbers
more file1 # paginate long file
head -n 2 file1 # first two lines
tail -n 2 file1 # last two lines
tail -n +1000 file1 # from line 1000 onward
cat file1 | head -n 3000 | tail -n +1000 # lines 1000‑29993. File Search
find, whereis, which
find / -name file1 # search from root
find / -user user1 # files owned by user1
find /usr/bin -type f -atime +100 # executable not accessed in 100 days
find /usr/bin -type f -mtime -10 # created/modified in last 10 days
whereis halt # locate binary, source, man
which halt # full path of executableDelete files larger than 50 M
find /var/mail/ -size +50M -exec rm {} \;4. Permissions
chmod – change mode
ls -lh # view permissions
chmod ugo+rwx directory1 # grant rwx to user, group, others
chmod go-rwx directory1 # remove rwx from group and otherschown – change owner
chown user1 file1 # change owner
chown -R user1 directory1 # recursive ownership change
chown user1:group1 file1 # change owner and groupchgrp – change group
chgrp group1 file15. Text Processing
grep – filter lines
grep Aug /var/log/messages # lines containing "Aug"
grep ^Aug /var/log/messages # lines starting with "Aug"
grep [0-9] /var/log/messages # lines with digits
grep Aug -R /var/log/* # recursive searchsed – stream editor
sed 's/string1/string2/g' example.txt # replace all occurrences
sed '/^$/d' example.txt # delete empty linespaste – merge files side by side
paste file1 file2
paste -d '+' file1 file2sort, uniq – sort and deduplicate
sort file1 file2
sort file1 file2 | uniq # unique lines
sort file1 file2 | uniq -u # lines only in one file
sort file1 file2 | uniq -d # common linescomm – compare two sorted files
comm -1 file1 file2 # exclude file1 lines
comm -2 file1 file2 # exclude file2 lines
comm -3 file1 file2 # only common lines6. Archiving and Compression
tar – create, list, extract archives
-c create
-t list contents
-x extract (use -C to specify directory)
-j use bzip2
-z use gzip
-v verbose
-f archive file name
-C change to directoryOther tools
bunzip2 file1.bz2
bzip2 file1
gunzip file1.gz
gzip file1
gzip -9 file1 # maximum compression
rar a file1.rar test_file
rar a file1.rar file1 file2 dir1
rar x file1.rar
zip file1.zip file1
unzip file1.zip
zip -r file1.zip file1 file2 dir17. System Shutdown, Reboot, Logout
shutdown -h now # halt now
init 0 # halt (method 2)
telinit 0 # halt (method 3)
shutdown -h hh:mm # schedule halt
shutdown -c # cancel scheduled halt
shutdown -r now # reboot now
reboot # reboot (method 2)
logout # log out
time command # measure execution time8. Process Management
jps – list Java processes
ps – snapshot of processes
-A all processes
-a without controlling terminal
-u user-oriented
-x together with -a for more info
-l long format
ps aux # all processes detailed
ps ax # without terminal
ps -lA # long format all
ps axjf # process treekill – send signals
kill -l # list signals
kill -9 3268 # force kill PID 3268killall – kill by name
killall nginx
killall -9 bash
killall -TERM nginxtop – interactive performance monitor
netstat – view listening ports netstat -tunlp | grep <port> Original source: https://www.jianshu.com/p/7c0df6fcfc71
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.
