21 Essential Linux Commands Every Sysadmin Should Master
Master the most useful Linux commands for everyday system administration, covering file navigation, permission handling, process control, text manipulation, compression, and system shutdown, with clear examples and syntax to boost efficiency and confidence in handling common operational tasks.
In Linux system administration, mastering a concise set of commands greatly improves efficiency and confidence when handling routine tasks.
File and Directory Operations
cd : Change directory. Example:
cd /home # enter /home directory
cd .. # go up one level
cd - # return to previous directoryls : List directory contents.
ls # list files
ls -l # detailed view
ls -a # include hidden filescp : Copy files or directories.
cp file1 file2 # copy file
cp -r /src /dest # recursive copy of a directory
cp -p file1 /backup # preserve timestamps and permissionsmv : Move or rename files.
mv file1 file2 # rename
mv /src /dest # move directoryrm : Remove files or directories (use with caution).
rm file1 # delete file
rm -r /dir # recursively delete directoryFile Content Viewing
cat and tac : Display file contents forward and backward.
cat file1 # view file
tac file1 # view file in reverse order
cat -n file1 # show line numbershead and tail : Show beginning or end of a file.
head -n 5 file1 # first 5 lines
tail -n 5 file1 # last 5 lines
tail -f logfile # follow a log file in real timePermission Management
chmod : Change file permissions.
chmod 755 file1 # rwxr-xr-x
chmod u+x file1 # add execute permission for ownerchown : Change file owner.
chown user1 file1 # set owner to user1
chown -R user1:usergroup /dir # recursive ownership changechgrp : Change file group.
chgrp group1 file1 # set group to group1Process Management
ps : List running processes.
ps aux # detailed list of all processes
ps -ef # full-format listingtop : Real‑time system resource monitor.
top # dynamic view of CPU, memory, processeskill and killall : Terminate processes.
kill -9 <pid> # force kill a specific PID
killall -9 program_name # kill all instances of a programFile Compression and Extraction
tar : Archive files.
tar -cvf archive.tar /dir # create tar archive
tar -xvf archive.tar # extract archivegzip and gunzip : Compress and decompress.
gzip file1 # compress
gunzip file1.gz # decompresszip and unzip : ZIP archive handling.
zip archive.zip file1 file2 # create zip
unzip archive.zip # extract zipText Processing
grep : Search file contents.
grep "error" logfile # case‑sensitive search
grep -i "error" logfile # case‑insensitive searchsort and uniq : Sort and deduplicate.
sort file1 # alphabetical sort
uniq file1 # remove duplicate linessed : Stream editor for text substitution.
sed 's/old/new/g' file1 # replace all occurrences of "old" with "new"System Related
shutdown and reboot : Power off or restart the system.
shutdown -h now # immediate shutdown
shutdown -r +5 # reboot after 5 minutesThese 21 commands cover file manipulation, permission management, process control, and text handling, providing a solid toolbox for Linux operations and enabling rapid response to common administrative challenges.
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.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
