What is a Linux shell?

3 min

Share via
102 shares, 2 points
Linux Shell

In this article, we will understand what a shell is and why we need it, and also look at the most commonly used command shells in Linux and Unix.

Quotes And Status Maker App

What is a shell?

Shell (or “shell”“command shell” ) is not only a command interpreter that provides an interface for interaction between the user and the operating system kernel but also a kind of programming language in which there are such constructions as conditional branching operators, loops, variables and much more.

The operating system (OS) launches a command shell for each user when they log in or open a terminal window. The first thing a user sees in a terminal window is a shell prompt – it usually consists of the username and hostname, separated by a character @, followed by the path of the current working directory and one of two characters: $or #.

If the user is not endowed with special rights, then the symbol will be displayed as a prompt to enter commands in the terminal $. If you were logged in as a privileged (root) user, then in the terminal you will see the symbol #:

Linux Terminal
Standard user terminal window ($ symbol visible)
Terminal Window For A Privileged (Root) User
Terminal window of a privileged ( root) user (# symbol is visible)

Note: The tilde (~) sign indicates that we are in the current user’s home directory.

After being prompted, the user enters various commands into the terminal, the shell launches programs for the user and then displays the result of their execution in the terminal. Commands can either be entered directly by the user or read from a file called a shell script or shell program.

Below is an example of executing a simple command datethat returns the current date and time:

Date And Time

Internal and external shell commands

The commands entered by the user are divided into two types:

  •    Internal commands are commands that are originally built into the shell.
  •    External commands are commands that are not built into the shell. At their core, they are rather small, separate programs located somewhere in the file system (usually in the /bin or /usr/bin directories).

To determine the type of command, just enter in the terminal windowtype <type_name>:

Type Of Command

As you can see, the team dirspwdcdand true– are internal commands of bash. But the commands unameidand whereis– are external, because they link to the corresponding files in the / usr / bin directory.

For a complete list of internal shell commands, use the command help:

Full List Of Internal Shell Commands

How do I know which shell I have installed?

If you are just starting with Linux and have not changed your shell, then it is most likely that your system is using bash. The easiest way to find out which shell is currently in use is to refer to the environment variable SHELL:

echo $SHELL

Which Shell I Have Installed

In addition, you can use a command psthat returns information about the process with a given identifier. In some cases, the shell identifier is the characters $$:

Information About The Process With The Specified Id

It’s not hard to see that the bash shell is currently being used. To view all available shells on your system, you need to refer to the contents of the etc / shells file :

cat /etc/shells

Bash Shell Is Currently Being Used

Command shell types

On Unix systems, there are two main types of shells called Bourne shell-based shells and C shell-based shells.

Typical Bourne shells are:

  • sh (Bourne shell)
  • bash (Bourne Again shell)
  • ksh (Korn shell)
  • zsh (Z Shell)

Type C Shells include:

  • csh (C shell)
  • tcsh (TENEX/TOPS C shell)

Like it? Share with your friends!

Share via
102 shares, 2 points

What's Your Reaction?

cute cute
lol lol
love love
scary scary
hate hate
geeky geeky
omg omg


Your email address will not be published. Required fields are marked *

20 − nine =