Loading
0x110Lesson 18 of 28

Terminal superpowers

Type less and do more with Tab, history, keyboard shortcuts, aliases and less.

20 min 5-question quiz
By the end of this lesson you can
  • 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

KeysWhat they do
TabComplete a command or file name. Press twice to list the options.
↑ / ↓Step through previous commands.
Ctrl-RSearch history as you type. Press again for older matches.
Ctrl-A / Ctrl-EJump to the start or end of the line.
Ctrl-U / Ctrl-KDelete to the start or end of the line.
Ctrl-WDelete the word before the cursor.
Ctrl-LClear the screen.
Ctrl-CGive up on this line, or stop the running command.
Ctrl-DEnd 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 XP

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

Up arrow: history. Tab: complete. Ctrl-L: clear. Ctrl-C: cancel.
  1. Let Tab type
  2. Tab through folders
  3. Reuse history
  4. 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 XP

Which key do you press?

Sort each situation by what you’d reach for.

0 of 5 sortedScore 0/0
  • “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 XP

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

0 of 4 sortedScore 0/0
  • “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…