Q1Which key do you press to have the terminal complete a filename you've started typing?
Using the Terminal Faster — Completion, History, Line Editing
Practice Tab completion, reusing history with the arrow keys and history, line editing with Ctrl-A/Ctrl-E/Ctrl-U, and history search with Ctrl-R, hands-on in a browser terminal.
Completion and History — Tab and Arrow Keys
Type part of a name and press the Tab key, and the terminal fills in the filename or command for you (completion).
Commands you've typed stay in the history, and you can recall and reuse them with the up/down arrow keys.
This saves you from typing long filenames and commands every time.
history is a command that lists the commands you've typed with numbers.
For a long command you use often, recalling it from history instead of retyping is faster and more accurate.
| Key / Command | Action |
|---|---|
Tab | Complete a filename or command you're typing |
↑ / ↓ | Recall the previous/next item in history |
history | List the commands you've typed, with numbers |
clear | Scroll the display away and start fresh |
history lists it.touch report_2026.txt # file to practice completion
ls rep[Tab] # type rep then Tab → completes to report_2026.txt
ls report_2026.txt # recall with the up arrow and rerun
Listing History and Clearing the Screen — history / clear
history is an actual command you type that shows the commands you've entered, with numbers.
When the screen fills with output, clear scrolls it away so you can start from a blank screen.
Neither is a keystroke — they're commands, so type them and run with Enter.
echo first # stays in history
echo second # stays in history
history # list the commands so far, with numbers
clear # scroll the display away and start fresh
Line Editing and Control — Ctrl Shortcuts
When you need to fix the start of a long command you're typing, going back one character at a time with the arrow keys is slow.
With Ctrl-key combinations, you can jump straight to the start or end of the line or delete input in bulk.
Ctrl-key combinations fall into three roles: moving, deleting, and control.
The table below organizes what each one does.
| Key | Action |
|---|---|
Ctrl-A | Move to the start of the line |
Ctrl-E | Move to the end of the line |
Ctrl-U | Delete everything before the cursor |
Ctrl-K | Delete everything after the cursor |
Ctrl-W | Delete the previous word |
Ctrl-L | Clear the screen |
Ctrl-C | Interrupt the running process |
Ctrl-D | Send end-of-input (EOF) |
echo this is a long line # type it, then Ctrl-A to the line start
# Ctrl-E back to the end, Ctrl-U to wipe the whole line
sleep 5 # a command that just waits 5 seconds. Ctrl-C to interrupt while running
Searching History — Ctrl-R
Pressing Ctrl-R enters the history search mode, and as you type, matching past commands appear as candidates.
When the one you want appears, press Enter to run it or Ctrl-C to leave the search.
With a candidate showing, pressing Tab pulls the command onto the input line without running it, so you can check or edit it before running.
Since you can recall a long command with just a few characters, it's faster than scrolling back forever with the arrow keys.
!! and !$ on Ubuntu and others
In bash on Ubuntu and similar systems, !! recalls the previous command and !$ the last word of the previous line (history expansion).
This course's console (busybox) doesn't support history expansion, so here we reuse history with Ctrl-R and the up/down keys.
Knowledge Check
Answer each question one by one.
Q2Which do you press to interrupt a running process?
Q3Which command lists the commands you've typed, with numbers?