Essential Linux Commands Every Sysadmin Should Know
This guide provides concise explanations, typical usage examples, and useful options for 30 essential Linux commands, helping readers quickly understand how to monitor system status, manage files, control processes, and perform common administrative tasks on Unix‑like systems.
This article presents a concise reference of common Linux commands, describing their purpose, typical usage, and useful options.
1. uptime command
The uptime command shows how long the system has been running, the number of logged‑in users, and the load averages for the past 1, 5 and 15 minutes.
# uptime
08:16:26 up 22min, 1 user, load average: 0.00, 0.03, 0.22To check the version:
# uptime -V
procps version 3.2.82. w command
The w command displays currently logged‑in users, their processes, and load averages, along with details such as login name, tty, remote host, login time, idle time, JCPU, PCPU, and the command being executed.
# w
08:27:44 up 34min, 1 user, load average: 0.00, 0.00, 0.08Available options:
-h: omit the header.
-s: omit JCPU and PCPU.
-f: omit the field information.
-V: display version.
3. users command
The users command lists the usernames of users currently logged in. It has no options besides --help and --version.
# users
Tecmint4. who command
The who command shows each logged‑in user’s name, date, time, and host information. Unlike w, it does not display what the user is doing.
# who
tecmint pts/0 2012-09-18 07:59 (192.168.50.1)Options:
-b: show the last system boot time.
-r: show the current runlevel.
-a, --all: display all available information.
5. whoami command
The whoami command prints the effective username of the current user. The equivalent who am i also works.
# whoami
tecmint6. ls command
The ls command lists files in a directory. Common options shown:
# ls -l
total 114
dr-xr-xr-x. 2 root root 4096 Sep 18 08:46 bin
...To sort by modification time:
# ls -ltr
total 40
-rw-r--r--. 1 root root 6546 Sep 17 18:42 install.log.syslog
...7. crontab command
The crontab utility manages user‑specific scheduled tasks. -l lists tasks, -e edits them (typically with vi).
# crontab -l
00 10 * * * /bin/ls >/ls.txt # crontab -e8. less command
The less pager allows forward and backward navigation through a file; press q to quit. # less install.log Sample output excerpt:
Installing setup-2.8.14-10.el6.noarch
warning: setup-2.8.14-10.el6.noarch: Header V3 RSA/SHA256 Signature,keyID c105b9de: NOKEY
Installing filesystem-2.4.30-2.1.el6.i686
...9. more command
The more pager also displays file contents page by page, showing a percentage progress indicator. # more install.log Sample output is similar to less.
10. cp command
The cp command copies files. -p preserves mode, ownership, and timestamps; -i prompts before overwriting.
# cp -p fileA fileB # cp -i fileA fileB11. mv command
The mv command renames or moves files. The -i option prompts before overwriting.
# mv -i fileA fileB12. cat command
The cat command concatenates and displays file contents. It can be combined with less or more for paging.
# cat fileA fileB # cat install.log | less # cat install.log | more13. cd command
The cd command changes the current working directory.
# cd /fileA14. pwd command
The pwd command prints the absolute pathname of the current working directory.
# pwd
/root15. sort command
The sort command orders lines of text alphabetically; -r sorts in reverse order.
# sort fileA.txt # sort -r fileA.txt16. vi command
The vi editor is a widely used text editor on Unix‑like systems. The -R option opens a file in read‑only mode.
# vi -R /etc/shadows17. ssh command
The ssh command initiates a secure remote login. Use -V to display the client version.
# ssh [email protected] # ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 201018. ftp / sftp command
The ftp and sftp commands connect to remote FTP servers; sftp provides encrypted transfers. Commands mput and mget upload and download multiple files.
# ftp 192.168.50.2 # sftp 192.168.50.2 # ftp > mput *.txt # ftp > mget *.txt19. service command
The service command runs init scripts located in /etc/init.d/. Example to start the HTTP daemon: # service httpd start or directly:
# /etc/init.d/httpd start20. free command
The free command reports memory usage, showing total, used, free, shared, buffers, and cached memory. The -t option adds a total line.
# free
total used free shared buffers cached
Mem: 1030800 735944 294856 0 51648 547696
-/+ buffers/cache: 136600 894200
Swap: 2064376 0 2064376 # free -t
...21. top command
The top utility provides a real‑time view of system processes, CPU usage, and memory consumption. Use -u username to filter by user, O to change sorting, and q to quit.
# top -u tecmint top – 11:13:11 up 3:19, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 116 total, 1 running, 115 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1030800k total, 736188k used, 294612k free, 51760k buffers
Swap: 2064376k total, 0k used, 2064376k free, 547704k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1889 tecmint 20 0 11468 1648 920 S 0.0 0.2 0:00.59 sshd
...22. tar command
The tar utility creates and extracts archive files. Example to create an archive of /home: # tar -cvf archive-name.tar /home To extract:
# tar -xvf archive-name.tar23. grep command
The grep command searches for patterns in files. Use -i for case‑insensitive matching.
# grep tecmint /etc/passwd
tecmint:x:500:500::/home/tecmint:/bin/bash24. find command
The find command locates files and directories based on criteria. Example searching for the string "tecmint" from the root filesystem:
# find / -name tecmint
/var/spool/mail/tecmint
/home/tecmint
/root/home/tecmint25. lsof command
The lsof utility lists open files. Example showing files opened by user tecmint:
# lsof -u tecmint
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 1889 tecmint cwd DIR 253,0 4096 2 /
sshd 1889 tecmint txt REG 253,0 532336 298069 /usr/sbin/sshd
...26. last command
The last command displays a list of recent logins, reboots, and shutdowns, useful for auditing user activity.
# last
tecmint pts/1 192.168.50.1 Tue Sep 18 08:50 still logged in
...Specify a username to filter:
# last tecmint27. ps command
The ps command reports a snapshot of current processes. Example showing the init process:
# ps -ef | grep init
root 1 0 0 07:53 ? 00:00:04 /sbin/init
root 7508 6825 0 11:48 pts/1 00:00:00 grep init28. kill command
The kill command sends signals to processes, typically to terminate them. Find the PID with ps and then use kill -9 PID to force termination.
# kill -9 750829. rm command
The rm command removes files. Use -i for interactive confirmation, -r for recursive deletion, and -f to force removal without prompts.
# rm filename # rm -i test.txt30. mkdir command
The mkdir command creates new directories. # mkdir directoryname This collection covers the most frequently used Linux commands for everyday system administration.
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.
