Language: EN


Learn to use the Raspberry Pi command console

In this post we are going to learn to use the Raspberry Pi command console, a very useful tool that we must learn to use if we want to delve deeper into the use of any PC with Linux.

The command console, or CLI, can be intimidating for new users. In fact, it is one of the ideas that most people have as a reference and generates the most reluctance when it comes to switching to a system like Linux.

The reason why the command console is still being used is simple. It is a very fast and powerful method for executing actions on a computer. Imagine the speed of performing any action using one of the many available commands, each of which can have several parameters, and which we can combine in countless combinations.

Of course, it is not about memorizing hundreds of commands. Not at all. In fact, no matter how many years you have been using Linux, you will probably always be able to find a new one. In addition, there is a lot of documentation on the subject, the command console itself has tools to give you help, and it is even normal to have “cheat sheets” or compilations of useful commands.

Therefore, you have to lose your fear of the command console. Also, it really is not as difficult as it seems. It’s a matter of starting to use it and little by little, almost without realizing it, you will be surprised at how comfortable you find it.

So to start losing the fear, let’s start by seeing what the command console or CLI is.

What is the command console?

The command-line interface (CLI) is a system for controlling a computer or program through commands entered as a simple text line.

The command console is a common tool in Unix-based operating systems, such as Linux. In general, it appears as a simple interface, in which the user enters commands and receives information from the system through text messages.

Over the years, in an era dominated by graphical interfaces (GUI, graphical user interface), the command console may seem archaic. However, it remains a powerful, fast, and very common tool in Unix systems.

CLIs are not exclusive to Unix. Traditionally, Windows has used cmd.exe as a command console. In the latest versions, Microsoft has enhanced its CLI by introducing PowerShell, which is much more powerful.

Most CLIs not only allow manual command entry, but also allow executing commands automatically from a text file called a script (equivalent to batch files in Windows).

Additionally, another reason why CLIs are still in full use is remote control of a computer. Using a remote CLI (such as ssh, which we will see at some point) allows actions to be executed quickly and efficiently, as we only send text and do not have to send/receive the video signal required by a GUI.

Command console, terminal or shell?

It is common to refer to the CLI as a command console, terminal emulator, or shell. Although they are different concepts, in practice it is common for them to be (incorrectly) used as synonyms since they are closely related.

To clarify the terms, a shell is any interface that allows control of an operating system. Therefore, the CLI is a shell, but there are also graphical shells.

The term terminal comes from the early computers, where you controlled the computer from a “device” that was basically a screen and a keyboard. The terminal emulator is the program that allows us to run a CLI in a graphical system and, as its name suggests, “emulates” these early terminals.

Finally, the CLI itself is the command interpreter, the program that receives the commands and executes the relevant actions in the OS.

In summary, on a computer with a windowing environment, the window system with mouse and keyboard capture is a shell. When we open a command console, that is also a shell.

The program we open is the terminal emulator. And what is inside it is the command interpreter or CLI.

To illustrate this, as an example, when we write a command and press Enter, it is the CLI that processes the data. But, for example, the function of copying and pasting a command, or displaying the output of the CLI, is specific to the terminal emulator.

What is Bash?

In Linux, there is more than one command-line interpreter. In fact, there are many. Some examples are Bash, Dash, KornShell (ksh), Tcsh, Fish, or Z Shell (zsh), among others, each with its advantages and disadvantages (and fans and detractors).

GNU Bash is the CLI implemented in the majority of Linux distributions. Examples of distributions that use Bash as the default CLI are Debian, openSUSE, Ubuntu, Fedora, Slackware, Mandriva.

As we know, Raspbian is based on Debian. So Bash is the CLI included by default in Raspberry Pi.

Bash, Bourne-Again SHell, was released in 1989. It is the predecessor of SH, The Bourne Shell, which is one of the original Unix CLIs. Bash scripts are compatible with SH, but Bash added additional functions such as autocompletion or command history.

For those curious, to check which CLI we are currently using we can use this command

echo $0

And to list all available CLIs on a system

cat /etc/shells


What is LXTerminal?

In a Linux system, just as there is more than one available CLI, there is more than one terminal emulator. Some examples of terminals are LXTerminal, Gnome Terminal, xterm, UXTerm, Lonsolem, among many others.

LXTerminal is the terminal emulator included in Raspbian by default, as it is the default terminal in LXDE Desktop, the graphical window interface used by default on Raspberry Pi.

If out of curiosity, anyone wants to check which terminal emulators are available on their system, they can type,

sudo update-alternatives --config x-terminal-emulator


As we can see, by default, in the case of Raspbian, only LXTerminal appears.

How to launch the command console on Raspberry Pi

Launching Bash, the default command console on Raspberry, is very simple. We have a button available on the top bar that launches Bash directly.


In other distributions, such as Ubuntu, the CLI is associated with the keyboard shortcut Control+Alt+T. In Raspbian, it is not, so if we want the shortcut, we will have to configure it ourselves.

At the beginning of each line where the user can enter a command, we will see a header with information provided to the user.



The meaning of this data is:

  • pi: indicates the user connected to the terminal
  • @raspberrypi: indicates the name of the machine to which we are connected
  • ~: indicates the path in which we are, in this case the default start path
  • $: indicator to start writing commands (it will be # if we are logged in as the root user)

Running commands in the command console

Executing an instruction is as simple as writing the command and pressing the enter key. If the command is correct, the CLI will perform the appropriate actions and the terminal emulator will display the result on the screen.

For example, to launch Chromium, the browser installed by default in Raspbian, we simply write the following command



Many commands accept additional parameters that modify the behavior of the command. Thus, chromium supports passing a URL as a parameter, and when opened it will load the specified URL directly. For example, to load the Google page directly, we write


If a command executes a process, and we want to cancel it, we can press the keyboard shortcut

control + C

If we want to clear the screen, removing all previously written commands, we run the command


Autocompletion with tab

One of the great “tricks” when using Bash, which will save us a huge amount of time, is the tab completion function.

If at any time while writing a command, a file name, or some arguments, we press the tab key Bash suggests the option that starts with what we have written. If there is more than one occurrence, the available options are cycled through.

If there are many occurrences, pressing tab will not display anything. Pressing it a second time will show us a list with the available commands. We can add a few more letters and press tab to complete the command.

So, following the example of chromium, if we press write ‘ch’ and press tab twice, it will show us a list with multiple available options.


If we complete up to ‘chrom’ and press tab, Bash autocompletes to chromium

The autocomplete function is especially useful when dealing with paths or file names.

Command history

Another function that will save us a lot of time and is one of the improvements that Bash introduced over its predecessor SH, is the command history.

At any time we can retrieve a previously written command by pressing the “up” key on the arrow keyboard. Pressing it successively will bring up the previous command, up to the beginning of the terminal session. If we have gone too far, we can press the “down” key to move to the next command.

A little help

Bash has certain commands that allow us to obtain help on available commands.


Some of these commands are

## Show a summary of the function of the command xxxxx
whatis xxxxx

## Show the most likely location for the program xxxxxx
whereis xxxxx

## List the manual pages that deal with the command xxxxx
apropos xxxxx

## Show the usage or configuration manual of the program xxxxx
man xxxxx

## Show the manual pages that contain the word xxxxx
man –k xxxxx

So far, this is enough to start losing the fear of the Raspberry terminal emulator. In a future post we will delve into some more aspects of Bash. In the meantime, here is a “cheat sheet” with some of the most useful commands of Bash.