What's a Shell?

What's a Shell?

What’s a Shell?
Category: Getting Started &nbsp
The Linux command line interface can be a somewhat frightening place at first glance to new users. Especially ones who have only ever known computing in the post-Windows 95 world of graphical user interfaces.

When they start looking at Linux, many new users begin to learn how to use the command line and come to know of its name of BASH.

Well BASH is only part of the story and it isn’t Linux’s only command line interface. So let’s take a look at shells.

If you’ve ever taken a look at desktop versions of Linux, you’ve possibly been surprised at the number of user interfaces that are available: Mate, Cinnamon, Unity, GNOME, KDE, LXDE, XFCE, Enlightenment, and the list goes on.

Different distributions ship with different interfaces and the choices are mostly made along the lines of what the developers of the distribution most prefer.  Many coming to Linux see the array of options and describe Linux as a confusing mess of options. In this regard, though, Linux is mostly about choice; the choice to pick an interface that you feel comfortable with and enjoy using, as opposed to the single option nature of Microsoft Windows that got people riled up with the interface changes with Windows 8. If you don’t like the user interface on Linux you can install another one and use that.

What many people don’t realise is that you can do exactly the same with the command line interface as well.

BASH as the Linux command line interface is something that most Linux users get used to. The fact that it is the standard command line interface on most of the popular Linux distributions and that the majority of help online assumes that you’re using it makes BASH feel like the only option, but there are others.

These interfaces, called shells, are replaceable and the default one for a user is specified in the file /etc/passwd. As and when a user logs in, the system reads the desired shell from that file and launches that for the user.

Below is a list of a number of shells and a brief description of relevant details…

Bourne Shell – This is a UNIX shell that became the de-facto standard in the UNIX world. While it introduced a number of features to shells many replacements for it exist that not only replicate its function but extend it.

C shell - This UNIX shell was devised around the idea of providing a shell with a scripting language similar to C which was the commonly-used programming language at the time.

BASH – The Bourne-Again SHell was written as a free replacement for the Bourne Shell that shipped with UNIX for many years and had become the de-facto standard there. It is released under the GNU public license and has become the defacto standard shell for most Linux distributions and Mac OSX. BASH takes in a number of features of the Bourne Shell, C shell and Korn Shell.

DASH – The Debian Almquist Shell is a replacement for the Almquist shell (ash) on Debian and related distributions, such as Ubuntu.  It is a Bourne Shell compatible shell which means that it can do everything the original Bourne Shell could, though lacks a number of additional features that BASH adds. On Debian and related distributions this is the shell called when using /bin/sh, traditionally the command for the Bourne Shell on UNIX. The purpose for this is that DASH gives much faster execution of Bourne Shell compatible shell scripts than BASH does.

BusyBox – This is another Bourne Shell compatible shell, only this was designed with a view to trying to incorporate the shell and most of the useful commands into a single small executable. As such, BusyBox has become a de-facto standard embedded systems shell for devices with limited processor or memory.  Many devices such as home routers and firewalls, smart TVs, media players, IP cameras, etc providing a command interface will likely use BusyBox for a shell. It also features a lot in system recovery distributions.

zsh - Zshell is yet another Bourne Shell compatible shell that implements further features beyond BASH’s. It offers greater file globbing than BASH making it easier to match files that may fit multiple patterns. It also features improved alias control over BASH, as well as great customisation options for the command prompt.

tcsh – TENEX C Shell is a descendent of the C shell and, as such, replicates its original functionality whilst improving the user interface somewhat.  If you have knowledge of the C programming language then a number of the features in tsch may make this a more useful shell for you.

ksh - Korn Shell is a Bourne Shell compatible shell implementing a number of features of tcsh but retaining the scripting formatting of the Bourne Shell. There are a number of clones available because, until 2000, the Korn Shell was proprietary code belonging to AT&T after which it was open sourced. One of its key features is the ability for the interactive command line to behave like VI, Emacs or XEmacs.

There are more shells out there, notably things such as perl shell which enables you to script in the perl language, and pysh a Python shell that combines the attributes of the traditional system shells with the interactive Python command line. Both of which may be useful if you have knowledge of those particular languages.

For most people, BASH should be more than suitable, which is why it’s been the standard shell for so long, though some experimentation may help you find a shell you prefer more than it.  An important aspect of explaining this is that sometimes you may find yourself using another shell that may seem unfamiliar compared to the common BASH prompt.  A number of times for example I’ve seen people dropped into a BusyBox prompt with its simple dollar sign and suffer confusion at its unfamiliarity.

Not all shells are the same, so it’s worth noting that sometimes you may face a different one.
    • Related Articles

    • Colouring Prompts to Differentiate Users

      Colouring Prompts to Differentiate Users Category: Getting Started &nbsp Command prompts are something that most of the big distributions have standardised these days. With BASH as the default shell with its highly customisable command prompt, it’s a ...
    • Automating Your Systems With Cron

      Automating Your Systems With Cron Category: Getting Started &nbsp Cron is a tool designed to schedule tasks and automate performing them. It comes as standard with pretty much all Linux distributions, making it easy to schedule the running of scripts ...
    • Configuring two-factor authentication in Ubuntu 14.04 using Google Authenticator

      Configuring two-factor authentication in Ubuntu 14.04 using Google Authenticator Category: Cloud Servers &nbsp Access control is one of the more important aspects of running a server. Making sure that users only have access to what they need and not ...
    • Ports and Protocols Explained

      Ports and Protocols Explained Category: Networking &nbsp Management of a VPS, and especially firewall configuration, can introduce you to a lot of strange and interesting terminology. One term that is relevant to these areas is the concept of ports. ...
    • Monitoring Processes With ps

      Monitoring Processes With ps Category: Getting Started &nbsp The importance of being able to see what the processes on your system are doing can never really be understated. It’s pretty much expected that at some point you’ll be staring at a terminal ...