Operations 9 min read

Boost Your Productivity: 20 Must‑Know Linux Command‑Line Tricks

A seasoned Linux engineer shares a curated collection of essential command‑line tricks—from formatting output with column and sorting processes, to automating repeats, monitoring with watch, and leveraging powerful tools like multitail, nohup, and xargs—helping you work faster and avoid forgetting useful shortcuts.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Boost Your Productivity: 20 Must‑Know Linux Command‑Line Tricks

As a Linux‑working engineer who uses the command line daily, I often forget useful tricks, so I compiled a handy list.

Format output into a clear table

Use column -t (or specify a delimiter with -s) to turn messy output like mount into a readable table.

Repeat a command until it succeeds

Wrap the command in a while true loop and redirect output to /dev/null to keep trying until it works.

Sort processes by memory usage

Run ps aux | sort -rnk 4 to list processes ordered by memory consumption.

Sort processes by CPU usage

Run ps aux | sort -nk 3 to order by CPU usage.

Check machine architecture

Execute getconf LONG_BIT to see whether the system is 32‑ or 64‑bit.

View multiple log files simultaneously

Install and use multitail (e.g., apt-get install multitail) to monitor several logs with highlighting and filtering.

Return to the previous directory

Simply type cd -.

Make a non‑interactive shell session interactive

Move settings from ~/.bashrc to ~/.bash_profile.

Periodically monitor command output

Use watch (e.g., watch df -h) to refresh any command’s output at regular intervals.

Keep a program running after the session ends

Run it with nohup (e.g., nohup wget site.com/file.zip &) or use screen to detach.

Automatically answer Yes or No

Pipe yes into a command ( yes | apt-get update) or use yes no for automatic “No”.

Create a file of a specific size

Use dd if=/dev/zero of=out.txt bs=1M count=10 to generate a 10 MB zero‑filled file.

Run the last command as root

Type sudo !! to repeat the previous command with sudo.

Record a shell session

Start script to capture everything you type into a file, then exit to finish.

Replace spaces with another delimiter

Use tr to translate characters, e.g., cat geeks.txt | tr ':' '\t' > out.txt.

Convert file contents to upper or lower case

Run cat myfile | tr a-z A-Z > output.txt to change case.

Powerful xargs usage

Combine find with xargs to process many files, or feed a list of URLs to wget. Use -i with placeholders for more complex commands.

These are just a few of the many Linux command‑line tricks you can use to work faster and smarter.

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.

LinuxproductivityShellcommand-lineSysadmin
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.