11 Little‑Known Linux Commands That Supercharge Your Workflow
This article introduces a collection of lesser‑known Linux commands—such as sudo !!, python -m SimpleHTTPServer, mtr, Ctrl+x+e, nl, shuf, ss, last, curl ifconfig.me, tree, and pstree—explaining their purpose, typical use‑cases, and providing concrete examples to help both desktop users and system administrators work more efficiently.
1. sudo !!
When a command fails due to missing privileges, you can re‑run it with sudo !! instead of re‑typing the entire command; !! expands to the previous command.
$ sudo !!2. python -m SimpleHTTPServer
Starts a quick HTTP server that serves the current directory on port 8000, useful for sharing files locally.
# python -m SimpleHTTPServer3. mtr
The mtr command combines ping and traceroute functionality. Install it with sudo apt-get install mtr on Debian‑based systems or yum install mtr on Red Hat‑based systems, then run mtr google.com to view the network path.
# sudo apt-get install mtr
# mtr google.com4. Ctrl+x+e
Pressing Ctrl‑x e in the shell opens the last command in your default editor (vi, vim, nano, etc.), allowing quick edits before execution.
5. nl
The nl command adds line numbers to a file. Example with a file one.txt containing a list of distro names:
# cat one.txt
fedora
debian
arch
slack
suseRunning nl one.txt produces:
1 fedora
2 debian
3 arch
4 slack
5 suse6. shuf
shufrandomly shuffles lines from its input. Use it to pick a random file or line, e.g. ls | shuf -n1 selects one entry from the current directory. # ls | shuf -n1 Replace -n1 with -n2, -n3, etc., to select multiple random entries.
7. ss
ss(socket statistics) displays detailed socket information, often more comprehensive than netstat. Example output shows TCP states, local/peer addresses, and ports.
# ss8. last
The last command reads /var/log/wtmp to show recent login sessions, including user, tty, and timestamps.
# last9. curl ifconfig.me
Retrieve your external IP address directly from the terminal with curl ifconfig.me. Install curl via the package manager if it is missing.
# curl ifconfig.me10. tree
Display the directory hierarchy in a tree‑like format. Example output shows files and sub‑directories under the current folder.
# tree
.
|-- Desktop
|-- Documents
| `-- 37.odt
|-- Downloads
| `-- attachments.zip
|-- Music
|-- Pictures
|-- Public
|-- Templates
`-- Videos11. pstree
pstreevisualises the process tree, showing parent‑child relationships of running processes in a format similar to tree.
# pstreeThese commands, while not always covered in basic tutorials, can dramatically speed up everyday tasks for both novice and experienced Linux users.
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.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
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.
