10 Lesser‑Known Linux Commands Every Sysadmin Should Master
Discover ten powerful yet underused Linux commands—including pgrep, pstree, bc, split, nl, mkfifo, ldd, col, xmlwf, and lsof—explaining their purposes, typical usage examples, and practical tips for effective system administration.
pgrep
Searches for processes by name or other attributes and prints their PIDs.
$ pgrep -u hchen
22441
22444Equivalent to ps -ef | egrep '^hchen' | awk '{print $2}'.
pstree
Displays the process hierarchy as a tree, making parent‑child relationships obvious.
$ pstree
init-+-acpid
|-auditd-+-python
| `-{auditd}
|-automount---4*[{automount}]
|-backup.sh---sleep
...bc
Arbitrary‑precision calculator useful for mathematical operations. Example script sqrt computes square roots:
#!/bin/bash
if [ $# -eq 0 ]; then
echo 'Usage: sqrt number'
exit 1
else
echo -e "sqrt($1)
quit
" | bc -q -i
fi $ ./sqrt 36
6
$ ./sqrt 2.0000
1.4142
$ ./sqrt 10.0000
3.1622split
Divides a large file into fixed‑size chunks.
$ split -b 50m largefile.tar.gz LF_
$ ls -l LF_*
LF_aa 52428800
LF_ab 52428800
...
LF_ai 17344374Recombine the pieces:
$ cat LF_* > largefile.tar.gznl
Numbers the lines of a file, similar to cat -n.
$ nl stdio.h | head -n 10
1 /* Define ISO C stdio on top of C++ iostreams.
2 Copyright (C) 1991,1994-2004,2005,2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
...mkfifo
Creates a named pipe (FIFO) for inter‑process communication via the filesystem.
$ mkfifo /tmp/hchenpipe
$ ls -l /tmp/hchenpipe
prw-rw-r-- 1 hchen hchen 0 ... hchenpipeWrite to the pipe (blocks until read): $ ls -al > /tmp/hchenpipe Read from another terminal:
$ head /tmp/hchenpipe
...output of ls -al...ldd
Lists the shared libraries required by an executable.
$ ldd /usr/bin/java
linux-gate.so.1 => (0x00cd9000)
libgij.so.7rh => /usr/lib/libgij.so.7rh (0x00ed3000)
... /lib/ld-linux.so.2 (0x00214000)col
Converts formatted man‑page output to plain text. Useful when piping man to a file.
# PAGER=cat
# man less | col -b > less.txtxmlwf
Validates an XML document, reporting well‑formedness errors such as mismatched tags.
$ curl 'https://coolshell.cn/?feed=rss2' > cocre.xml
$ xmlwf cocre.xml
cocre.xml:13:23: mismatched taglsof
Lists open files; when combined with grep it can show network sockets.
$ lsof | grep TCP
httpd 548 apache 4u IPv6 14300967 TCP *:http (LISTEN)
sshd 1764 root 3u IPv6 4993 TCP *:ssh (LISTEN)
...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.
