← Linux and the Command Line Lesson 1 of 51 · 5 XP

The terminal: help, man, history, clear

Theory

Machine translation, not yet reviewed by a native speaker.

The terminal is a window where you talk to the computer in text. The program that reads your commands and runs them is called the shell: bash, zsh, sh. Our built-in Linux runs sh from the BusyBox toolkit.

The input line starts with a prompt, for example ~% or user@kali:~$. A command looks like this:

command -options arguments
ls -l /home

Where to get help:

ls --help          # short help for almost any program
man ls             # the detailed manual; to exit, press q
help cd            # help on the shell's built-in commands (in bash)
type cd            # what it is: a program, a built-in command or an alias

Our mini Linux has no man — to save space. Kali and any ordinary Linux have it.

History and conveniences:

history            # a list of the last commands
!!                 # repeat the last command (sudo !! — repeat it with sudo)
!42                # run command number 42 from the history
clear              # clear the screen (or Ctrl+L)

Keyboard shortcuts that save hours:

key action
↑ / ↓ scroll through the history
Tab complete a file or command name (twice — show the options)
Ctrl+C interrupt the running command
Ctrl+D end of input / leave the shell
Ctrl+R search the history (bash)
Ctrl+A / Ctrl+E to the start / to the end of the line

Many tasks in the course are scripts: files with commands that run in order, as if you were typing them yourself. The check runs your script in a real Linux right in the browser, each time in a new empty folder.

Try it yourself: Programmers' Room → Linux · sh.

Sign up for free to mark finished lessons and track your progress.