A detailed guide to introduce users to Shell idea in Linux and the well-known BASH shell
A “Shell” is an “Interactive Utility’ that is provided through Linux systems. When we talk about the command line in the Linux as well as Unix environment, we refer to the “Shell”. It acts as a middleman with the computer and user that receives feedback from users and then feeds the input into the systems.
The Linux shell is a means to allow users to begin programs, or to manage and alter any information within the Linux system. The shell provides an interface for users to communicate with the system via commands.
Command Prompt is the most essential and fundamental component that makes up the Shell within Linux as well as Unix systems. It is the prompt that defaults for all Linux distributions, and specifically for those that use Bourne Shell. Command Prompt serves as an interface that allows you to enter the commands. The commands are then and executed by the kernel. Shell commands are the initial program that you execute when you open the terminal window.
In this short article, you will be able to learn the basics regarding the Shells in Linux and also the issue of the default shell that comes with Linux will be answered.
Table of Contents
Types Of Shell
In Linux, there are two main types of shells: Bourne Shell and C-type shell. Both kinds of Shell offer advantages, but some disadvantages.
We will look at the specifications of these kinds in the next sections.
Bourne Shell
Bourne Shell was written by Stephen Bourne at AT&T Bell Labs. Bourne Shell ( sh
) was the first shell to be integrated into the Linux systems. It is running as the /bin/sh
on the majority of Linux distributions.
However, Bourne Shell was pretty popular and was a popular choice back then, it was not without its flaws. The ability to remember previous commands was not present in the Shell. sh
was lacking many of the modern features such as aliases, which rendered it less efficient.
-
Denoted as
sh
-
It is the
"$"
symbol is used as the prompt that is default.
The following are subcategories from Bourne Shell. Bourne Shell.
-
Bourne Shell (
sh
) -
Korn Shell (
ksh
) -
Bourne Again Shell (
bash
) -
POSIX Shell (
sh
)
C-Type Shells
C-type shell was developed with the C-programming language developed created by Bill Joy. C-Shell or ‘ csh
is regarded as an improvement over Bourne Shell ( sh
). C-Shell
introduced a variety of new features, including commands history, aliases and command histories that were not present in Bourne Shell. Bourne Shell.
-
Denoted as
csh
-
The
character %
symbol is the prompt that defaults to.
While it was an improvement over the Bourne shell it faced some issues. Another major issue with the csh
is that it demanded users to be familiar with C-programming as it was developed upon the C-language.
The following are subcategories of those of the type C Shells.
-
C Shell (
csh
) -
Shell TENEX/TOPS (
tcsh
)
On the Linux platforms, users are able to discover the various shells that are available in your system by using the cat
command. The information on the shells can be found in the shells directory in the /etc/shells
directory. Follow the below command to get the information about the shells.
cat /etc/shells
Output:
gaurav@ubuntu:~$ cat /etc/shells # /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash gaurav@ubuntu:~$
The Default Shell On Linux
For the answer to “Which is the default shell in Linux?”, the best answer is BASH
‘ (Bourne Again Shell). BASH
is the most well-known shell, and is therefore used in the majority of Linux operating systems as default.
To test the default shell of Linux You can do so by using this command.
echo $SHELL
Output:
/bin/bash
This implies that the current shell running for my machine is BASH. BASH
shell.
You can verify the current version of the BASH
on your Linux system by using this command
bash --version
Features Of BASH Shell
BASH
is backwards compatible with Bourne Shell ( sh
). BASH has many notable features of both the Korn Shell ( ksh
) and C-Shell (csh). C-Shell ( csh
).
BASH has many features that were not present in its predecessors. This is undoubtedly what makes the BASH shell a significant improvement over the previous versions. Numerous new features, including wildcarding, piping, and tab-completion are among the major improvements that make BASH an ideal shell to use as the default option for many versions of Linux distributions.
Let’s take a look at some of the most important characteristics that are part of Bash shell.
Command History: The command will save you the effort of having to type a long command again. Command History feature recalls the previously typed commands that can be navigated in the terminal using the arrow keys.
Command Line Editing The feature was new to BASH. It lets the user move around the terminal from left to right , and from right-to-left. The terminal’s navigation might seem like a normal thing now, however it was a substantial improvement over the previous versions.
Aliens: This is a function that is derived of the C-shell. It lets users enter only the short name of the command. The shell will then translate the short command into long-form commands.
One Dimensional Array: 1-D arrays in BASH allow easy reference of data. The manipulation of the lists of data also is feasible.
Startup Files: Startup Files contain scripts that Bash runs and reads when it’s started. Every file has been assigned for the specific task.
Environment Security: BASH provides you with an amazing feature called “Restricted Mode’. The BASH
beginning with rbash
lets the shell operate in restricted mode.
Because of all these noteworthy characteristics that the bash shell has, it is the most popular shell for Linux and similar Unix-like systems. This is the same reason it’s widely used as the default shell of all Linux distributions.
Commands are available via the BASH shell
BASH
shell gives you an array of commands that simplify your work and manage all actions within your system via the command line itself. Here are a few of the most important commands that that the BASH
shell can provide on Linux distributions.
NOTE: The list of commands that are available in BASH is not limited to the list of commands available on BASH shell is not limited to this table. Here are a few of the most important commands that are used for illustration purposes.
Command |
Description |
|
command to erase the contents of a file |
|
command to erase the directory or file |
|
Command to make an empty document |
|
command to create an entirely new directory |
|
Command to display the title of the current working directory |
|
Command to modify the directory |
Conclusion
When we look at the essential and fundamental aspects that are available in the BASH shell We can conclude the BASH shell has become the most most popular shell among the alternatives due to its powerful design, user-friendly features and an extensive array of commands that make the user’s experience easy. We can also declare BASH is the default shell on Linux distributions. BASH is the preferred shell for Linux distributions.