20 Essential Linux Terminal Tricks to Boost Your Productivity
This article presents a curated collection of practical Linux command‑line shortcuts—including tab completion, directory navigation, batch execution, history search, log monitoring, and alias usage—that can dramatically reduce keystrokes and streamline everyday system‑administration tasks.
Below are several professional Linux command‑line tricks that can save you a lot of time and avoid many hassles, helping you improve work efficiency.
1. Use the Tab key for auto‑completion
When you start typing a command, pressing Tab suggests all possible options that begin with the entered string, e.g., typing cp l and pressing Tab shows linuxidc.txt.
2. Switch back to the previous working directory cd - This returns you to the last directory without typing the full path.
3. Return to the home directory cd ~ or simply cd Both commands take you to ~ from any location, saving a couple of keystrokes.
4. List directory contents with ll
Instead of ls -l, many distributions support the shortcut ll which provides the same detailed listing.
5. Run multiple commands in one line command_1; command_2; command_3 Separate 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_2 Use && to ensure the second command runs only when the first exits successfully (e.g., sudo apt update && sudo apt upgrade).
7. Quickly search your command history
Press Ctrl+R and type a keyword to perform a reverse search through previously entered commands.
ctrl + r keyword8. Unfreeze a frozen terminal
On many Unix‑like systems, Ctrl+S pauses output (freezes the terminal). Press Ctrl+Q to resume.
9. Jump to line start or end
Use Home / End keys, or Ctrl+A to move to the beginning and Ctrl+E to move to the end of the line.
10. Real‑time read log files tail -F linuxidc_log The -F option follows the file name, retrying if the file is rotated or recreated.
11. Read compressed logs without decompressing
Use the z suite (e.g., zless, zcat, zgrep) to view .gz files directly.
zcat linuxidc_log.zip | more12. Use less to read files
less -N linuxidc.txt lessprovides paging, searching, line numbers, and highlighting, making it superior to cat for large files.
13. Reuse the last argument of the previous command
Type !$ (or Alt+.) to insert the final argument from the prior command.
14. Reuse the entire previous command
Enter !! to repeat the last command; prepend sudo to quickly gain root privileges (e.g., sudo !!).
15. Use aliases to fix typos
Define an alias such as alias gerp=grep to correct frequent misspellings. alias gerp=grep 16. Copy‑paste in the terminal
Select text and right‑click to paste (PuTTY, Windows SSH clients) or middle‑click on Linux. Keyboard shortcuts: Ctrl+Shift+C to copy, 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 > filename 19. Find files containing specific text grep -Pri "search_string" path For more advanced searches, refer to the find command documentation.
20. Use the built‑in help for any command
Most commands provide a help page via command --help (e.g., bc --help). bc --help These tips work on almost all Linux distributions and shells without installing additional tools, and using aliases can further simplify complex commands.
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.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
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.
