Why use the Linux shell?

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.

8 Responses to “Why use the Linux shell?”

  1. rssmatters July 9, 2009 at 6:01 am #

    Another advantage is my hands do not have to leave the keyboard to use the mouse, hence increase productivity. IM on shell, anyone? Serious. πŸ™‚

  2. Selinap July 9, 2009 at 8:35 am #

    Keeping your hand on the keyboard may reduce the RSI problem.

  3. The Guru July 9, 2009 at 9:52 am #

    You are right, I just love Unix Shell. Is way better and powerful than Windows Batch program πŸ˜€

  4. AhTim July 9, 2009 at 11:36 am #

    Agreed. Speed is main concern especially for troubleshooting.

  5. Haniff Bin Anuar July 9, 2009 at 6:43 pm #

    yup i agree too bro!

  6. Jayce July 10, 2009 at 11:35 am #

    Yup. Agreed with Tim.

  7. steve July 31, 2009 at 10:04 pm #

    That’s for sure.The bash shell is a powerful and extremely efficient way to use the resources of a system.Helps you avoid all the bottlenecks encountered while navigating the gui, especially on a low end system.Work with the shell for a while and you’ll think twice about using the gui except for maybe certain niche tasks.

  8. linux commands May 29, 2011 at 8:39 am #

    I am not sure where you’re getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for great info I was looking for this info for my mission.

Leave a Reply