Boost Your Linux Productivity with 8 Essential Command‑Line Tools
This guide introduces eight powerful Linux commands—rsync, screen/tmux, lsof, python -m, vimdiff, nc, date, and systemctl—explaining their key options, typical use‑cases, and providing ready‑to‑run examples that help you work faster and smarter on the command line.
rsync
rsync is ideal for incremental backups and selective copying because it only transfers changed files. It also supports compression, bandwidth limiting, and exclusion patterns.
scp -Crvp -l 1024 logs/ root@remoteServer:/opt/logsTypical rsync usage:
rsync -prz --exclude 'bin' --bwlimit=1024 logs/ root@remoteServer:/opt/logsOptions: -r recursive, -p preserve attributes, -z compress, --bwlimit limit bandwidth, --exclude skip files, --progress show progress.
screen & tmux
Both tools let you keep sessions alive after disconnecting from a remote host. screen is often pre‑installed; tmux offers more features but may require installation.
# 1 Start a screen session and run a command
screen vim /etc/hosts
# 2 Detach (Ctrl+a d)
# 3 List existing sessions
screen -ls
# 4 Reattach to a session (example ID 14000)
screen -r 14000lsof
lsoflists open files, which on Unix includes network sockets and device handles. It provides many filters to narrow results.
# List files opened by processes 123 and 456
lsof -p 123,456
# Show all TCP connections
lsof -i tcp
# Find the process using port 8080
lsof -i :8080python -m
The -m flag runs a library module as a script, offering quick one‑liners for common tasks.
# Start a simple HTTP server on port 9080
python3 -m http.server 9080
# Pretty‑print JSON from stdin
python -m json.toolvimdiff
vimdiffinvokes Vim in diff mode, allowing side‑by‑side comparison with colour highlighting. Navigation commands are built into Vim.
vim file1 file2 ]c– jump to next difference [c – jump to previous difference
nc (netcat)
Netcat is a versatile networking utility for creating connections, listening sockets, and simple data transfers. It can be used to open a reverse shell, test connectivity, or scan ports.
# Server: listen on port 5879 and execute a shell
nc -l -vv -p 5879 -e /bin/bash
# Client: connect to the server
nc -v 192.16.1.54 5879
# Keep listening after client disconnects
nc -l -k -p 5879 -e /bin/bash
# Simple port scan
nc -vzw 2 192.16.1.54 8888-9999Convert Unix timestamp to readable date
Use the date command to translate epoch seconds into a formatted string. On macOS the flag is -r instead of -d.
# Linux
date -d @1658054000 +'%Y-%m-%d %H:%M:%S'
# macOS
date -r 1658054000systemctl
To list all enabled services on a systemd‑based host, pipe the output of systemctl to a pager.
systemctl -l -t service | lessSigned-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.
