Productivity Tricks
Work faster in the terminal.
Experienced Linux users type surprisingly little. They know a handful of tricks that save thousands of keystrokes. Here are the best ones.

- Experts type little
- A handful of tricks
- Thousands of keystrokes saved
Brace expansion
Curly braces expand into several words. Make dir dash P project, with src, docs, and tests in braces, makes three folders in one go. CP notes dot TXT, comma dot bak, copies the file to notes dot TXT dot bak. And braces with dot dot count for you.
mkdir -p project/{src,docs,tests} && ls project docs src tests cp notes.txt{,.bak} && ls notes* notes.txt notes.txt.bak echo file{1..5}.txt file1.txt file2.txt file3.txt file4.txt file5.txt
Jumping back
CD dash takes you back to the folder you were just in, and prints it. Run it again, and you jump back again. It's perfect for switching between two folders.
cd /var/log cd - /home/sam cd - /var/log
Shortcuts to remember
Bang bang repeats the last command, so sudo bang bang reruns it with sudo, when you forgot. Control R searches your history as you type. Alt dot pastes the last argument of the previous command. And control L clears the screen, just like clear.
| key | value |
|---|---|
| sudo !! | last command, with sudo |
| Ctrl + R | search your history |
| Alt + . | last argument again |
| Ctrl + L | clear the screen |
Summary
Braces make many names at once, CD dash jumps back, sudo bang bang fixes a forgotten sudo, and control R finds old commands. Next, getting ready for Linux interview questions.
Key takeaways- mkdir -p a/{b,c}
- cd -
- sudo !! and Ctrl + R