20 Essential Linux Terminal Tricks to Boost Your Productivity
This article presents a collection of practical Linux command‑line techniques—from tab completion and directory navigation to log monitoring and command chaining—that help both beginners and seasoned users work faster, avoid common pitfalls, and streamline everyday terminal tasks.
1. Use Tab for Auto‑completion
Press the Tab key while typing a command to automatically suggest completions that start with the characters you have entered, saving keystrokes and reducing errors.
2. Switch Back to the Previous Directory
cd -The cd - command returns you to the last working directory without re‑typing the full path.
3. Return to the Home Directory
cd ~or simply cd, which is pre‑configured in most modern shells and saves a few keystrokes.
4. List Directory Contents Quickly
llOn many Linux distributions, ll is an alias for ls -l, providing a detailed listing with less typing.
5. Run Multiple Commands on One Line
command_1; command_2; command_3Separate commands with a semicolon to execute them sequentially without waiting for each to finish.
6. Run the Next Command Only If the Previous Succeeds
command_1 && command_2Use && so the second command runs only when the first exits successfully (e.g., sudo apt update && sudo apt upgrade).
7. Search Your Command History
ctrl + rPress Ctrl + R and type a keyword to perform a reverse search through your Bash history; press Ctrl + C to exit.
8. Unfreeze a Stuck Terminal (Ctrl + S)
In many Unix‑like systems, Ctrl + S pauses output; press Ctrl + Q to resume.
9. Jump to Line Start or End
Ctrl + A # move to start of line
Ctrl + E # move to end of lineThese shortcuts are especially handy on laptops where Home/End keys may be less accessible.
10. Follow Log Files in Real Time
tail -F linuxidc_logThe -F option follows the file by name and retries if the file is recreated.
11. Read Compressed Logs Without Decompressing
zcat linuxidc_log.zip | moreUse zcat, zless, or zgrep to view gzipped logs directly.
12. Use less to Browse Files
less -N linuxidc.txt lessprovides paging, searching, line numbers, and does not load the entire file into memory.
13. Reuse the Last Argument of the Previous Command
!$After creating a directory, you can quickly change into it with cd !$. An alternative is Alt + .
14. Repeat the Previous Command with !!
!!Useful for re‑executing a command with sudo, e.g., sudo !!.
15. Create Aliases to Fix Typos
alias gerp=grepDefine an alias in .bashrc to correct frequent misspellings.
16. Copy and Paste in the Terminal
Select text and right‑click to paste (common in PuTTY).
Select text and middle‑click to paste.
Use Ctrl + Shift + C to copy and Ctrl + Shift + V to paste.
17. Terminate a Running Command
Press Ctrl + C to stop the current process.
18. Empty a File Without Deleting It
> filenameThis truncates the file to zero length.
19. Find Files Containing Specific Text
grep -Pri "search_string" pathSearch recursively, ignoring case, and display matching file names.
20. Use Help for Any Command
$bc -helpMost commands provide a built‑in help page that explains usage and options.
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.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
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.
