Linux Labs

First steps / Stage 3 of 15

Working comfortably in the terminal

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 3 min

One key in two places

What you will learn

  • Fix a command before running it and repeat commands from history.
  • Complete names with Tab and find the line you need in long text.
  • Get the prompt back with an interrupt and know what stays done.

You scroll through a long log, close it, and want to repeat your last command. Press the same key in two places and compare what it does.

The log is in the ~/terminal-practice directory. Start on the card creates the directory and takes you into it.

Exercise · look

The log and the prompt

In ~/terminal-practice, open the log with less notes.txt and click the terminal. Press the Down arrow a few times, then the Up arrow, and quit with q. Back at the prompt, press the Up arrow again and see what appears on the line.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why did the Up arrow scroll lines in the log but bring back a command at the prompt?

  • The terminal keeps no commands: it passes keystrokes on and shows text. The last command came from the program that read the arrow at the prompt.

  • While the log is open, the arrows move its lines. The command appeared on the line at the prompt, after q.

  • It did: the log lines moved. Open less notes.txt again and press the arrow a few times — the text scrolls.

The arrow was read by the program running at that moment: less in the log, the shell at the prompt.

Ubuntu 24.04
Loading…