How to access or open a Shell in Linux

This tutorial explains how to get or access a shell interface in Linux. Learn how to start or open a shell in popular Linux distributions such as Ubuntu and Red Hat.

There are several ways to get or access a shell interface in Linux. The three most common methods are the shell prompt, terminal window, and virtual console. Let's discuss these methods in detail.

The shell prompt

Linux is mostly used on server systems. Server systems provide dedicated services and typically do not require a desktop environment to manage them. Because of this, Like Windows, using a desktop environment to manage the system is not common in Linux.

Depending on whether the desktop environment is installed or not, Linux can be classified into two types: Linux with a desktop environment and Linux without a desktop environment. In both types, the method to access the shell prompt is a little bit different.

No matter which type of Linux you have, in both types, you can access the shell only after the login. The main difference between both types is that in the first type, Linux automatically opens the default shell but in the second type you have to open the shell manually.

Let's access a shell prompt in both types.

Boot your Linux system. If the desktop environment is not installed or currently disabled, you will see a plain-text login prompt. The following image shows the plain-text login prompt on an Ubuntu system.

cli login prompt Ubuntu

To log in, type your username and hit the Enter key. After the username, type your password and press the Enter key again. If your username and password are correct, Linux will present a shell prompt to you just after the authentication.

The following image shows the shell prompt that a user will get if the user uses the command line interface to login in Ubuntu.

shell prompt on ubunutu

If the desktop environment is installed and working properly, you will see a graphical login screen. The following image the graphical login screen on an Ubuntu system.

GUI login screen Ubuntu

To log in, type your username and press the Enter key. After the username, type your password and hit the Enter key again.

The following image shows this process on an Ubuntu system.

GUI login Ubuntu

If the username and password are correct, Linux starts the graphical user interface for you. The following image shows the desktop environment that a user gets if the user uses the graphical interface to login in Ubuntu.

gui desktop Ubuntu

The following image shows the desktop environment that a user gets if the user uses the graphical interface to login in CentOS/Red Hat.

GUI deskop CentOS

As you can see in the above pictures, if we log in using the GUI (graphical user interface), Linux does not open a shell prompt for us automatically.

Accessing a shell through the terminal window

In GUI, to open a shell prompt manually, we have to access a terminal window. A terminal window is an application that starts the default shell in the GUI environment. To start a terminal window, right-click on the Desktop and select the "Open in terminal" option from the right-click context menu.

right-click context menu Ubuntu

Not only from the Desktop, but also you can access a shell prompt from any directory by using the same right-click context menu. For example, the following image shows how a user can access a shell prompt from the Documents folder of his home directory.

accessing shell from right-click menu

Different distributions usually use a different title for this option such as New Terminal, Terminal Window, Shells, Open in Terminal, Xterm. Some distributions even do not include this option in the right-click context menu.

If this option is not available in the right-click context menu, you can also start a terminal window from the panel. Usually, Linux desktops include a panel at the top, or bottom, or left of the screen from which you can start applications. You can open a terminal window from the panel as well.

For example, if your distribution uses the GNOME 2 desktop, you can open a terminal window by going through the following steps.

Applications => System Tools => Terminal

Or if your distribution uses the GNOME 3 desktop, you can use the following steps.

Activities => type Terminal in the search box => press the Enter key

The following image shows how to access a terminal window on a Centos/Red hat/Fedora system.

accesssing shell in CentOS GUI

Accessing a shell by using virtual consoles

A virtual console is a way to open and use multiple shell sessions at once in addition to the existing GUI or CLI interface. Most Linux distributions provide six virtual consoles along with the graphical interface.

By holding the CTRL+ALT+F1 (or F2, F3, F4, F5, F6) keys together you can switch between these virtual consoles. Since each virtual console opens a separate shell session, you can log in from a different user on each virtual console.

In Fedora/CentOS/Red Hat Linux, if GUI is installed, the first workspace is the GUI and the next six virtual consoles are text-based virtual consoles. To access a text-based virtual console, press CTRL+ALT+(Related function key).

For example, to access the third virtual console, press CTRL+ALT+F3. To return to the GUI, press CTRL+ALT+F1. You can switch between text-based virtual consoles and the graphical console as much as you like.

The following image an example of accessing a shell through a virtual console on the Centos system.

accessing shell through virtual console

That's all for this tutorial. If you like this tutorial, please don't forget to share it through your favorite social channel.

Advertisements

ComputerNetworkingNotes Linux Basic tutorials How to access or open a Shell in Linux