Most PC users communicate with the operating system on their machines using a graphical user interface (GUI), such as those used in Microsoft Windows 2000 or Mac OS 9. Linux has its own GUIs, most notably GNU Network Object Model Environment (GNOME) and the K Desktop Environment (KDE). GUIs provide buttons, menus, icons, and all the other point-and-click features that have simplified modern computing so greatly. However, it is a mistake to assume that GUIs are always the best way to communicate with an operating system. Although GUIs certainly provide simplicity, they tend to obscure some of a computer’s capabilities from the user. This is where a shell comes in.

linux shell

Advantages of using a shell

Greater control
A shell is a program that acts as an interface between the user and the operating system, just as a GUI does. However, a shell works without graphics – when you use one, you issue instructions to the operating system by typing in commands. In fact, the shell is often referred to as a command interpreter.

This may seem like a return to basic computing, but a command-line interface lets you exercise a degree of control over the operating system that would otherwise be lacking. There are a number of reasons for this:

  • with a GUI, only the options provided by the interface are available to the user
  • lack of space on a screen can limit the number of options that a GUI displays
  • no standard methods exist within GUIs for performing standard command-line tasks, such as linking commands in sequences, redirecting output from one destination to another, or collecting commands into scripts

A disadvantage of using a command-line interface is that the user needs to learn a wide variety of sometimes cryptic commands and their associated options. However, the commands are more powerful and adaptable than their GUI counterparts, because they can be extended and fine-tuned through the use of options. An expert user of a command-line interface can issue complex commands very quickly. Techniques also exist to link multiple commands together with pipes and redirections, so that the output of one command becomes the input of another. Linux can interpret commands issued using the shell more quickly than GUI commands. This is because shell commands are nothing more than simple ASCII text. Some shells even enable you to define your own commands.

Automation of common tasks
A shell has another advantage over a GUI in that it keeps a history list of recently issued commands. This enables a user to step back and forth through this list, reusing commands at any point. In addition, a shell enables you to string commands together to form a shell script. These scripts work in a similar way to batch files, issuing multiple commands as one. You can use them to automate common tasks that would otherwise require you to issue several, consecutive commands.

Speed and efficiency
In hardware terms, a shell is a more attractive proposition than a GUI. Shells are much less resource-intensive than GUIs – they require less memory, for example. This means that a command issued in the shell will run more quickly and efficiently than the same command run in a GUI. It also means that a shell supports Linux’s multitasking environment, in which multiple tasks run simultaneously, more comfortably than a GUI, in which the GUI itself competes for CPU resources.

Shell evolution

Since its creation as a derivative of UNIX, Linux has given rise to a number of shells, which have evolved along with the operating system itself. When a new shell is developed, it doesn’t spell the end for all previous shells. Many different Linux shells are available, and each has particular strengths. The one you use depends on your own preferences and on the task you wish to undertake.

The default shell in most Linux installations is the Bourne Again shell, or /bin/bash. It is a successor to the Bourne shell, or /bin/sh, which was an early and less powerful Linux shell. The Bourne Again shell was created and is distributed by the Free Software Foundation. It offers features such as command-line editing and filename completion. It is an ideal first shell for Linux newcomers. In addition, bash supports the syntax used by another Linux shell called the C shell, or /bin/csh, which increases its flexibility.

You can find out which shell you’re running at any time by typing the command echo $SHELL at the shell prompt. The default shell is specified in the /etc/passwd file and can be changed there for each user.

Since we are talking about Linux here, you might want to know how to mount linux file system also understand on Linux File Types.