Linux Shell

What is the The Shell?

When discussing the command line, we’re talking about the shell. The shell is software that receives keyboard commands and then executes them through the operating system. Most Linux distributions come with a shell program called bash, which is part of the GNU Project. The term “bash” stands for “Bourne Again SHell,” highlighting its role as an improved version of the original Unix shell program, “sh,” created by Steve Bourne.

Terminal

When working with a graphical user interface, we require a terminal emulator to interact with the shell. These emulators can usually be found in our desktop menus. For example, KDE uses “konsole,” while GNOME uses “gnome-terminal,” often listed as “terminal” in the menu. Although there are various terminal emulators available for Linux, they all serve the same purpose: providing access to the shell. Over time, you might develop a preference for a particular emulator based on its features and customization options.

Your First Keystrokes

So let’s get started. Launch the terminal emulator! Once it comes up, we should see something like this:

[me@linuxbox ~]$

This is called a shell prompt and it will appear whenever the shell is ready to accept input. While it may vary in appearance somewhat depending on the distribution, it will usually include your username@machinename, followed by the current working directory (more about that in a little bit) and a dollar sign.

If the prompt ends with a pound sign (“#”) instead of a dollar sign, it indicates that the terminal session has superuser privileges. This could mean that we are logged in as the root user or that we are using a terminal emulator that grants superuser (administrative) privileges.

Command History

Pressing the up-arrow key on the keyboard displays the previous command after the prompt, a feature known as command history. By default, most Linux distributions remember the last 500 commands. Conversely, pressing the down-arrow key hides the previously displayed command.

Cursor Movement

After recalling the previous command with the up-arrow key, try using the left and right-arrow keys. Notice how you can move the cursor anywhere on the command line? This functionality makes editing commands very convenient.

Ending A Terminal Session

To end a terminal session, you can either close the terminal emulator window or enter the “exit” command at the shell prompt.

[me@linuxbox ~]$ exit

Leave a Comment