Accessing the command line

Terminal EmulatorGNOMEKonsoleXtermTerminal Shortcuts

In our recent journey at Linux Command Line - Overview, we've delved into the foundational elements of the Linux operating system, exploring its core system and indispensable GNU utilities. This foundational knowledge not only provides insights into the inner workings of Linux but also serves as a crucial stepping stone for our upcoming exploration into the Linux command line.


Accessing the command line

UNIX-like systems have a command line interface (CLI) for interaction. The command line interface gets text base input from the user to interact with the system. Nowadays Linux distribution uses a graphical desktop environment but still requires a command line interface to execute shell commands.

Almost all Linux distributions come with graphical desktop mode and command line mode. Command line mode is a simple text mode to read text input from users just like old days operating systems and it's called Linux virtual console. The Linux system provides some default virtual consoles/terminals. Linux graphical desktop distribution uses a terminal emulator application to interface the Linux system.

What is a terminal emulator?

A terminal emulator is a software program that replicates the functionalities of a physical computer terminal. It allows a computer to emulate a text-based terminal, enabling users to interact with the system through a command line interface.

Let's discuss some CLI Mode:


Linux Console Terminals

Most Linux distributions provide some virtual consoles. A virtual console is a terminal session that runs on a Linux system. All virtual consoles are created at boot time.

If you're wondering about what is different between virtual console and linux console? The Linux console is the physical interface that gets all kernel messages (information, warnings etc.) and enables single-user mode login. On the other hand, virtual consoles are additional command-line interfaces accessible on a Linux system. They are not physically connected to the Linux console or the physical console. Users can create and use multiple virtual consoles concurrently, and each operates independently.

To access the command line interface, users can press Ctrl+Alt+(F1 to F7). Each function key (F1, F2, etc.) corresponds to a different console, and the number of consoles may vary between Linux distributions. Some distributions offer four consoles, while others provide even more.

Below is a sample of a console login screen:

Ubuntu 20.04.6 LTS abc-****-*****-* tty4

abc-****-*****-* login: abc
Password:
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-89-generic x86_64)

  * Documentation: https://help.ubuntu.com https://landscape.canonical.com
  * Management:
  * Support: https://ubuntu.com/advantage

Expanded Security Maintenance 'for' Infrastructure is not enabled.

36 updates can be applied immediately.
26 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Enable ESH Infra to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

New release '22.04.3 LTS' available.
Run "do-release-upgrade' to upgrade to it.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Thu Nov 30 11:56:41 IST 2023 on tty3
abc@abc-****-*****-*:"$

Users can log in to the Linux virtual console by entering the system username and password. In the example above, you can observe that abc is the username. The term tty4 in the first line indicates that it's the 4th virtual console. Here, tty refers to a terminal device or console, and TTY stands for teletypewriter or teletype terminal.

Linux virtual consoles typically operate in a text-based mode and may not support the execution of graphical programs.


Graphical Terminals

Linux graphical desktop environment provides a terminal emulation package. A terminal emulation package is a virtual environment to interact with the system. There are several graphical terminal emulation packages available. All having unique features and functions.

Let's take a look at some of them, as listed below:

NameDescription
GNOME TerminalGNOME Terminal is a terminal emulator for the GNOME desktop environment.
konsoleKonsole serves as a terminal emulator designed for the K Desktop Environment.
xtermxterm program is a terminal emulator for the X Window System.
XFCE4XFCE4-Terminal is a terminal emulator for the XFCE desktop environment.
YakuakeYakuake is a drop-down terminal emulator based on KDE Konsole technology.

Most Linux distributions natively support GNOME Terminal, Konsole, or xterm as default terminal emulators. Let's discuss each one in detail:

GNOME Terminal Emulator

GNOME Terminal is the default command tool for the GNOME desktop. It's also a common default terminal for various other Linux distributions. If a Linux distribution doesn't come with GNOME Terminal pre-installed, GNOME Terminal can be easily added to the system using the following command:

sudo apt install gnome-terminal

To open a GNOME Terminal on your system, the process varies among different Linux systems. The default terminal can be accessed either by using the shortcut key Ctrl+Alt+T or through the Application Menu Bar.

Let's explore some handy shortcuts for using the GNOME Terminal:

Shortcut KeyDescription
Ctrl + Alt + TInitiates a new shell session.
Shift + Ctrl + TStarts a new shell session from the current one.
Shift + Ctrl + W / Ctrl + DClose the current tab.
Shift + Ctrl + QClose the current terminal window.
Ctrl + Page UpSwitch to the previous tab.
Ctrl + Page DownSwitch to the next tab.
Alt + 1/2/3.. <tab number>Navigate to a particular tab.
Ctrl + Shift + Page UpMove the current tab left.
Ctrl + Shift + Page DownMove the current tab right.
Ctrl + Shift + CCopy selected text to the clipboard.
Ctrl + Shift + VPaste text from the clipboard.
Ctrl + AMove to the beginning of the line.
Ctrl + EMove to the end of the line.
Ctrl + UDelete from the cursor to the beginning of the line.
Ctrl + KDelete from the cursor to the end of the line.
Ctrl + LClear the terminal.
Ctrl + Shift + FOpen the find dialog to search for text in the terminal.
Ctrl + Shift + GFind the next occurrence of the search term.
Ctrl + Shift + HFind the previous occurrence of the search term.
Ctrl + +Zoom in.
Ctrl + -Zoom out.
Ctrl + 0Reset zoom to default.
Ctrl + CInterrupt (stop) the current command.
Ctrl + ZSuspend the current command.
Konsole Terminal Emulator

Similarly to GNOME, Konsole comes with a range of basic to advanced features. It is specifically developed for the KDE desktop environment, providing users with a versatile terminal emulator. Konsole supports multiple tabs, customizable profiles, and a variety of features for efficient command-line interactions within the KDE environment.

If a Linux distribution doesn't come with Konsole Terminal pre-installed, Konsole Terminal can be easily added to the system using the following command:

sudo apt install konsole

To enhance efficiency while working with the console, it's essential to be familiar with some basic shortcuts. Konsole provides several useful shortcuts to streamline the experience.

Let's discuss some of the Konsole shortcuts:

Shortcut KeyDescription
Ctrl + Alt + TInitiates a new shell session. (KDE desktop environment)
Ctrl + Shift + TOpen a new tab
Ctrl + Page DownSwitch to the next tab
Ctrl + Page UpSwitch to the previous tab
Shift + Ctrl + W / Ctrl + DClose the current tab
Ctrl + AMove to the beginning of the line
Ctrl + EMove to the end of the line
Ctrl + UDelete from the cursor to the beginning of the line
Ctrl + KDelete from the cursor to the end of the line
Ctrl + Shift + CCopy selected text to the clipboard
Ctrl + Shift + VPaste text from the clipboard
Ctrl + Shift + FOpen the find dialog
Ctrl + Shift + GFind the next occurrence
Ctrl + Shift + HFind the previous occurrence
Ctrl + +Zoom in.
Ctrl + -Zoom out.
Ctrl + 0Reset zoom to default.
Ctrl + CInterrupt (stop) the current command.
Ctrl + ZSuspend the current command.
Xterm Terminal Emulator

Xterm is one of the oldest terminal emulators and has been in use since the early days of the X Window System. It was developed as a part of the X Window System, which is the underlying technology for graphical user interfaces in Unix and Unix-like systems.

Xterm has remained a popular choice for many users due to its lightweight nature and widely compatibility. If a Linux distribution doesn't come with Xterm Terminal pre-installed, Xterm Terminal can be easily added to the system using the following command:

sudo apt install xterm

Using the xterm -help command provides a comprehensive list of supported command-line parameters. These parameters offer greater control and efficiency when utilizing the terminal, allowing users to customize and optimize various features.


Summary

In summary, our discussion encompassed virtual consoles, Linux consoles, and graphical console emulators. We delved into the efficiency of terminal usage, exploring key shortcuts in terminals like Konsole and Xterm. The importance of these shortcuts in enhancing productivity and control was highlighted.