Linux Labs

First steps / Stage 1 of 15

Understanding Linux and your terminal

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · theory · 3 min

Who runs a command

Between pressing Enter and seeing the output, several programs get to work, each with a job of its own.

The terminal passes on your keystrokes and shows the text that programs print. It does not understand commands itself.

The line is read by the shell — here, the program Bash. It splits the line into words: the first is the command name, and the rest go to the program itself — options, for example. By that name the shell finds a program and starts it. In uname -sr, the uname program asked the kernel and printed its name and release, and the terminal displayed that text.

When the program finishes, the shell prints the prompt — the student@ubuntu:~$ line before the cursor. The prompt means the shell is waiting for the next command. You do not type it.

The shell looks up a program name letter for letter, and upper and lower case differ: uname and Uname are two different names to it.

Check yourself 1 question

You typed Uname -r and got this output. What do you do?

Command 'Uname' not found, did you mean:
  command 'uname' from deb coreutils (9.4-3ubuntu6.2)
Try: sudo apt install <deb name>
  • The terminal only showed the text the shell printed. In a new terminal Uname -r is still not found: the name is the same.

  • The option never came into play: the shell found no Uname program, so nobody read -r. With the same option, uname -r works.

  • The message names the package that holds a similar command, uname, and it is already installed: uname -r works. There is nothing to install; fix the name.

The message comes from the shell: it found no Uname program, because upper and lower case differ for it. Ubuntu adds a hint about a similar command and a package, but for a typo it is enough to fix the name and run the line again.

Key points

  • The terminal passes on keys and shows text; the Bash shell parses the line.
  • The shell looks up a program by its exact name and starts it.
  • The prompt is the sign that the shell is waiting for a new command.
Ubuntu 24.04
Loading…