Operations 9 min read

20 Essential Linux Commands Every Sysadmin Should Master

This article provides concise, step‑by‑step explanations of 20 common Linux commands—from checking runlevels and default gateways to rebuilding initramfs, using cpio, patch, aspell, dig, and locating files—complete with example outputs and helpful screenshots for quick reference.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
20 Essential Linux Commands Every Sysadmin Should Master

1. How to view the current Linux runlevel? Answer: Use who -r or runlevel commands.

2. How to view the default gateway? Answer: Use route -n or netstat -nr, which also display the routing table.

3. How to rebuild the initramfs image on Linux? Answer: On CentOS 5.x / RHEL 5.x use mkinitrd. Example:

Replace uname -r with the desired kernel version for a specific kernel.

On CentOS 6.x / RHEL 6.x use dracut. Example:

To rebuild for a specific kernel:

4. What does the cpio command do? Answer: It copies files into or out of an archive and can extract files from it.

5. What is the patch command and how to use it? Answer: patch applies changes (diff output) to files, converting an old version to a new one. Example workflow: create a diff file, then apply it with patch as shown:

Both old and new files can be single files or directories; -r enables recursive processing.

Applying the patch:

6. What is aspell used for? Answer: It is an interactive spell checker for Linux, a free alternative to ispell, usable both as a library for other programs and as a standalone command‑line tool.

7. How to view a domain's SPF record from the command line? Answer: Use the dig command. Example:

8. How to identify the package that provides a specific file (e.g., /etc/fstab )? Answer:

The command lists the package owning /etc/fstab.

9. Which command shows the status of bond0 ? Answer:

10. What is the purpose of the /proc filesystem? Answer: It is a memory‑based virtual filesystem that exposes kernel and process information such as CPU, memory, partitions, I/O addresses, DMA channels, and running processes. It is maintained automatically by the system.

11. How to find files larger than 10 MB under /usr ? Answer:

12. How to locate files in /home modified more than 120 days ago? Answer:

13. How to find files in /var not accessed in the last 90 days? Answer:

14. How to locate and delete all files named "core" in the entire directory tree? Answer:

15. What does the strings command do? Answer: It extracts and displays printable strings from binary files, useful for analyzing suspicious executables during intrusion investigations.

16. What is the purpose of the tee filter? Answer: It duplicates standard input to multiple destinations, such as writing to a file while also sending output to the screen or another program.

17. What does export PS1="$LOGNAME@hostname:\$PWD:" change? Answer: It modifies the shell prompt to show the username, hostname, and current working directory.

18. What does ll | awk '{print $3,"owns",$9}' do? Answer: It lists files and prints each file's owner and name.

19. What is the purpose of the at command? Answer: It schedules a one‑time task to run at a specified future time, with jobs stored in /var/spool/at and executed by the atd daemon.

20. What does the lspci command show? Answer: It displays information about PCI buses and attached devices; options -v, -vv, or -vvv increase verbosity, and -r improves readability.

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.

UnixSystem Administrationcommands
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.