Operations 13 min read

20 Essential Linux Terminal Tricks to Supercharge Your Productivity

This guide presents twenty practical Linux command‑line shortcuts—including tab completion, directory navigation, command chaining, history search, log monitoring, and alias usage—that help both beginners and seasoned users work faster, avoid common pitfalls, and boost overall terminal efficiency.

Liangxu Linux
Liangxu Linux
Liangxu Linux
20 Essential Linux Terminal Tricks to Supercharge Your Productivity
Linux terminal overview
Linux terminal overview

1. Use Tab for Auto‑completion

Press Tab while typing a command to let the shell suggest completions that start with the characters you have entered, e.g., typing cp l then Tab may complete to linuxidc.txt.

Tab completion example
Tab completion example

2. Switch Back to the Previous Directory

The command cd - returns you to the directory you were in before the last cd. It relies on the OLDPWD environment variable, which is set only after a successful directory change.

cd - example
cd - example

3. Return to the Home Directory

Use cd ~ or simply cd to jump to your home directory from anywhere.

cd ~ example
cd ~ example

4. List Directory Contents Quickly

Many users rely on ls -l, but the shortcut ll (often an alias) provides the same detailed view on most Linux distributions.

ll command output
ll command output

5. Run Multiple Commands on One Line

Separate commands with a semicolon: command_1; command_2; command_3. All commands run sequentially without waiting for the previous one to finish.

6. Run the Next Command Only If the Previous Succeeds

Use the && operator: command_1 && command_2. A common example is sudo apt update && sudo apt upgrade, which upgrades only after a successful update.

7. Search Your Command History

Press Ctrl+R to start a reverse incremental search. Type a fragment of a previous command; the shell shows the most recent match. Press Ctrl+R repeatedly to cycle through older matches, and Ctrl+C to exit.

Reverse search demo
Reverse search demo

8. Unfreeze a Frozen Terminal

On many Unix‑like systems, Ctrl+S pauses output (freezes the terminal). To resume, press Ctrl+Q.

Ctrl+S freeze animation
Ctrl+S freeze animation

9. Jump to the Beginning or End of a Line

Use Home / End keys, or the more portable shortcuts Ctrl+A (start of line) and Ctrl+E (end of line).

10. Follow a Log File in Real‑time

Run tail -F <logfile> to continuously display new lines as they are appended, automatically retrying if the file is rotated or recreated.

tail -F example
tail -F example

11. Read Compressed Logs Without Decompressing

Use the z suite: zless, zcat, zgrep, etc., to view or search gzip‑compressed files directly.

zcat linuxidc_log.zip | more
zcat example
zcat example

12. Use less to Read Large Files

less -N <filename>

displays the file with line numbers, allows forward/backward navigation, searching, and does not load the entire file into memory.

13. Reuse the Last Argument of the Previous Command

Type !$ to insert the final argument from the most recent command, e.g., after mkdir newdir you can run cd !$ to change into it.

!$ usage
!$ usage

14. Repeat the Entire Previous Command

Enter !! to execute the last command again. Prefix it with sudo (e.g., sudo !!) to rerun the previous command with elevated privileges.

!! usage
!! usage

15. Create Aliases to Fix Typos

Add an alias in ~/.bashrc, e.g., alias gerp=grep, so a misspelled command automatically resolves to the correct one.

16. Copy‑Paste in the Terminal

Typical shortcuts: Ctrl+Shift+C to copy, Ctrl+Shift+V to paste. In some clients, selecting text and right‑clicking also works, and the middle mouse button can paste.

17. Terminate a Running Process

Press Ctrl+C to send an interrupt signal, stopping the current foreground command.

18. Empty a File Without Deleting It

Redirect nothing into the file: > filename. This truncates the file to zero length while keeping the file itself.

19. Find Files Containing Specific Text

Use grep -Pri "search_string" /path/to/dir to recursively search case‑insensitively for a string in all files under a directory.

20. Use Built‑in Help for Any Command

Most commands provide a help page via command --help or by invoking the command without arguments. Example: bc -help displays usage information.

bc help output
bc help output
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.

AutomationLinuxproductivitycommand-lineTipsterminal
Liangxu Linux
Written by

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.)

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.