A Unix shell is a command-line interpreter or shell that provides a traditional Unix-like command line user interface. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute, or by creating text scripts of one or more such commands. Users typically interact with a Unix shell using a terminal emulator, however, direct operation via serial hardware connections, or networking session, are common for server systems.

Computers understand the language of zeros and ones known as binary language. In the early days of computing, instructions were provided using binary language, which is difficult for all of us to read and write. Therefore, in an operating system there is a special program called the shell. The shell accepts human readable commands and translates them into something the kernel can read and process.


Basic Command Line Editing
You can use the following key combinations to edit and recall commands:

CTRL + L : Clear the screen.
CTRL + W : Delete the word starting at cursor.
CTRL + U : Clear the line i.e. Delete all words from command line.
Up and Down arrow keys : Recall commands (see command history).
Tab : Auto-complete files, directory, command names and much more.
CTRL + R : Search through previously used commands (see command history)
CTRL + C : Cancel currently running commands.
CTRL + T : Swap the last two characters before the cursor.
ESC + T : Swap the last two words before the cursor.
CTRL + H : Delete the letter starting at cursor.

mohammedrafi@NOC-RAFI:~$ ssh root@
root@’s password:
Last login: Tue Apr 19 09:28:31 2016 from

[root@li911-180 ~]# echo $SHELL

[root@li911-180 ~]# cat /etc/shells 

[root@li911-180 ~]# chsh /bin/sh 
chsh: user “/bin/sh” does not exist.

[root@li911-180 ~]# useradd -s /bin/sh jack

[root@li911-180 ~]# passwd jack
Changing password for user jack.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

[root@li911-180 ~]# su – jack
-sh-4.1$ echo $SHELL
-sh-4.1$ ls -l
total 0
-sh-4.1$ pwd

-sh-4.1$ w
06:17:56 up 51 days, 14:51,  1 user,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     05:39    1.00s  0.06s  0.00s w

[root@li911-180 ~]# echo $SHELL

[root@li911-180 ~]# chsh 
Changing shell for root.
New shell [/bin/bash]: sh
chsh: shell must be a full path name.

[root@li911-180 ~]# chsh 
Changing shell for root.
New shell [/bin/bash]: /bin/sh
Shell changed.

[root@li911-180 ~]#echo $SHELL

[root@li911-180 ~]# cat /etc/passwd | grep root

[root@li911-180 ~]# logout

Connection to closed.
mohammedrafi@NOC-RAFI:~$ ssh root@
root@’s password:
Last login: Mon Apr 25 05:39:28 2016 from

Bourne shell
The Bourne shell, sh, was a complete rewrite by Stephen Bourne at Bell Labs. Distributed as the shell for UNIX Version 7 in 1979, it introduced the rest of the basic features considered common to all the Unix shells, including here documents, command substitution, more generic variables and more extensive builtin control structures. The language, including the use of a reversed keyword to mark the end of a block, was influenced by ALGOL 68. Traditionally, the Bourne shell program name is sh and its path in the Unix file system hierarchy is /bin/sh. But a number of compatible work-alikes are also available with various improvements and additional features. On many systems, sh may be a symbolic link or hard link to one of these alternatives:
Almquist shell (ash): written as a BSD-licensed replacement for the Bourne Shell; often used in resource-constrained environments. The sh of FreeBSD, NetBSD (and their derivatives) are based on ash that has been enhanced to be POSIX conformant for the occasion.
Bourne-Again shell (bash): written as part of the GNU Project to provide a superset of Bourne Shell functionality. This shell can be found installed and is the default interactive shell for users on most GNU/Linux and Mac OS X systems.
Debian Almquist shell (dash): a modern replacement for ash in Debian and Ubuntu
Korn shell (ksh): written by David Korn based on the Bourne shell sources while working at Bell Labs
Public domain Korn shell (pdksh)
MirBSD Korn shell (mksh): a descendant of the OpenBSD /bin/ksh and pdksh, developed as part of MirOS BSD
Z shell (zsh): a relatively modern shell that is backward compatible with bash
Busybox: a set of tiny utilities for small and embedded systems, which includes a shell
The POSIX standard specifies its standard shell as a strict subset of the Korn shell, an enhanced version of the Bourne shell. From a user’s perspective the Bourne shell was immediately recognized when active by its characteristic default command line prompt character, the dollar sign ($).
There are many different shells that can be used in the Unix environment. Each shell has its own features, strengths, and weaknesses. The C Shell is very useful and powerful in its own right, but there are other Shells that add functionality that can make working in the Unix environment more enjoyable. In this section, we will discuss two popular Unix Shells briefly, and highlight a few of the differences between them.

Feature sh csh bash tcsh
Job Control: the jobs command No Yes Yes Yes
Aliasing: renaming complex commands with simple names No Yes Yes Yes
Command History: re-execute frequently used commands quickly No Yes Yes Yes
Command line editing: correct a mis-spelled command name in a complicated command by using the arrow keys and backspace No No Yes Yes
Filename Completion: complete long filenames with a single keystroke No Yes Yes Yes
List Variables: the shell has a built-in list data type, useful when scripting No Yes No Yes
Fully programmable completion: complete command names, hostnames, usernames, etc. with a single keystroke No No No Yes
Can follow symbolic links invisibly No No Yes No
Custom Prompt (easily): for example, change the prompt to display the current working directory No No Yes Yes
Underlying syntax (when writing scripts) sh csh sh csh
Can cope with large argument lists Yes No Yes Yes
Freely available: download the shell and possibly the source code, for free! No No Yes Yes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s