Terminal superpowers
Type less and do more with Tab, history, keyboard shortcuts, aliases and less.
- Use Tab completion and history instead of retyping commands
- Edit a command line with the keyboard shortcuts every shell shares
- Read long output with less, and save a command as an alias
Watch an experienced engineer at a terminal and it looks like magic. It isn’t speed typing: they barely type at all. Their shell finishes names, remembers commands and fixes mistakes for them. These habits take an afternoon to pick up, and you’ll use them for the rest of your career.
Stop typing everything
| Keys | What they do |
|---|---|
| Tab | Complete a command or file name. Press twice to list the options. |
| ↑ / ↓ | Step through previous commands. |
| Ctrl-R | Search history as you type. Press again for older matches. |
| Ctrl-A / Ctrl-E | Jump to the start or end of the line. |
| Ctrl-U / Ctrl-K | Delete to the start or end of the line. |
| Ctrl-W | Delete the word before the cursor. |
| Ctrl-L | Clear the screen. |
| Ctrl-C | Give up on this line, or stop the running command. |
| Ctrl-D | End of input. At an empty prompt, it logs you out. |
Two history tricks are worth knowing: !! repeats the last command, so sudo !! retries it with sudo, and !$ means the last argument of the previous command.
Try it
Up to 15 XPUse your superpowers
Use the real keys here: Tab to complete and the up arrow for history. Ctrl-L clears and Ctrl-C abandons a line.
Mission 1 of 4
Let Tab type
Ada: “Don’t type that long file name. Print the maintenance schedule with Tab. Try cat deck-seven-m, then Tab.”
Simulated shell. Try ls, or type help to see the commands.
- Let Tab type
- Tab through folders
- Reuse history
- Make an alias
Read long output with less
less shows a file one screen at a time, and it’s also what man uses, so these keys work in both:
- Space and b go forward and back a page, and g and G jump to the start and end.
- /word searches forward, then n and N go to the next and previous match.
- q quits. This is the key people need most.
Try it
Up to 15 XPWhich key do you press?
Sort each situation by what you’d reach for.
“You ran a long curl command yesterday and want it again.”
“A command has hung and you want your prompt back.”
“You’re stuck reading a man page.”
“You can’t remember the exact file name.”
“You’ve typed half a line and changed your mind.”
Coming from PowerShell
Try it
Up to 15 XPTranslate the idea
Many tasks exist in both shells. The big difference is that Bash pipes text, while PowerShell pipes objects. Match each Bash command to the PowerShell equivalent.
“ls”
“grep ERROR app.log”
“cat notes.txt”
“sort -nr”
Key takeaways
Tab finishes names and proves that they exist.
The up arrow and Ctrl-R beat retyping.
q quits less and man.
Bash pipes text, while PowerShell pipes objects.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…