Types Of Shells And Shell Commands

Unix Shell - Types Of Shells And Shell Commands


shell scripting
image source:-http://www.tonypickett.com

It is a program that interprets the commands and transfers to the kernel for execution. It is available in middle part of Unix architecture. Unix system uses different types of the shell to check the command and help to execute also. The shell sets up the standard input, standard output, and standard error.

1. Bounce shell:

It is a shell that is developed by Dr.steven Bourne at APSI Unix feature and its related command. It also supports wildcards, background execution, programming concept etc.

2. C shell:

It is a shell that is developed by Bill Joy at the University of California. This shell supports all feature of bourne and also support the program concept the c programming language. It provides input-output re-direction, customization, environment, arthimetic process, built-in operator.

3. Korn shell:

It is a shell that develops by David Korn at APST lab. It supports the university system and all features of about shell and allows to manage history, Advance editor, special symbols for controlling the commands.

4. Bash shell:

It is a shell that is used in Unix for executing the advance command and all features of about shell. This shell developed by Brian Fox and Chet Ramey. It is the latest shell develop for GNU project. It supports command line editing, filed representation, advanced wildcards shell command, and variables aliasing etc.

Shell Interpreting Cycle:

The shall is used to check the command and execute using the kernel in a circular format. When a shell is waiting for the user to enter a command then transfer at waiting for a state. The user enters another command then transfer at working state. The process of shell manages the command between kernel and user in a particular given cycle.


Unix operating system support wildcards to such the contents files and data from the particular location. The Bash shell supports different wildcards character for defining the searching criteria/process.

 1. ? :

It is a wildcard that uses for single character searching pattern.

Ls, a??a↵

Ls +a??a↵


2. * :

It is a wildcard character that used for multiple characters.

Ls a*

Ls a*a

3. [abc]:

It is a wildcard that displays the contents which are related to ABC.


4. [!abc]:

It is a wildcard that displays those contents which are not ABC.


5. [a-p]:

It is a wildcard that displays those contents which are in between a-p.


6. [!a-p]:

This wildcard display those records which are not in between a-p.


7. 0-9:

This wildcard display the range value as numeric.

cat a(1-5)*↵

Escaping And Quoting:

Escaping and quoting is the process to manage the wildcard feature it means the wildcards character related processing can a omit using \ use before the wildcard character for omitting the feature of wildcard character for omitting the feature of wildcards. It is basically used to display those type of contents which are defined with wild character.

1. Quote:

It is used to define set of character together and use wildcard features also inside the quote.


cat M*←

cat M|*↵

cat chap[1-3]↵

2. Different between single and double quote:

The single quote is used to define a command and double quote is used to enclose the part of a command. The double quote also used to define the set of characteristics.

Shell And Variables:

It is a variable that holds the value as temporary. Variable is a way to define temporary memory location to contain the value and it erases after terminating the program. Shell also supports variables for containing the value at particular memory.

1. Echo command:

It is a command that displays the message and value of the variable. We use the $ symbol with the variable to display the value.


echo $a↵


echo ab↵

2. Environmental variable:

It is a pre-defined variable that contains the value of the system. Unix system uses built-in variables to hold the value as permanent and use for system processes.

A) Path variable:

It is a variable that contains the value as system path of the particular application. We can display the path which is defined by the user.


B) Home variables:

It is a variable that displays the absolute path of the current working directory. We can display the output using this variable.


C) PS1 and PS2 variable:

It is a variable that allows assigning the particular value on command prompt identification it means we can change the identifier of the command prompt. PS1 variable identifies the primary prompt of Unix command and PS2 identify the secondary command of the command prompt it means the $ symbol and symbol can change with the particular identifier using PS1 and PS2 variable respectively. This variable also defined in system manage the prompt identifier.




3. Mail variable:

It is a variable that contains the incoming mail. The user can display the emails using particular directory. The emails are stored in mail directory at mail variable.

4. Log Name:

It is a variable that contains the username of the currently logged. It means we can display the user details using log name variable.

5. TERM:

It is a variable that identifies the terminal name into the networking.

Command Substitution:

Unix operating system allows us to create the substitute of a particular command and uses as the alternative. It means we can define the feature of a particular command into the particular variable. We can execute the output of a particular command using a particular variable. We define the command into a single quote and assign on the particular variable.





echo”The current date is $abc”↵


It is a command that allows creating the alternative of the particular command. It means we can directly store the command on the particular variable using Alias command. This command is available in Kern and Besh shell for creating the substitute of the command we use = sign to assign the command variable and execute with the help of given variable.


alias var=cmd↵


alias list=ls↵

alias dog=cat↵

Setting Terminal:

The system displays the default setting of the operating system. We can set the default setting with the new definition of the system terminal.

1. Stty:

It is a command that displays the default setting of the command prompt. The user can also change the setting of a terminal using this command. We use an option to display the all default setting.



Command Line Shortcut:

Unix operating system allows us to define the command shortcuts for executing at the command prompt. We basically used wildcards characters to define the command shortcuts on the command prompt. The use of wildcards and metacharacter to find the expression of the particular word that is known as globing. We use wildcard character with the particular word for searching the file from the particular location we use a particular command to define the command line shortcut for excessing the file. The keyword alpha, upper-lower digit, space etc to search the pattern related to these keys. We use a command with this keyword as command line shortcut.




1. File and command competition:

It is a technique that allows completing the file or directory name without re-typing the complete name. We use particular command and file name for executing the commands, but we can define the single character of the file name and press tab to complete the related file name. If the existing key is unique then display particular file. Otherwise, display its related files.

cat a<tab>

2. History:

The C korn and Besh shell allow us to repeat the executed command without re-typing on the command prompt. Linux system store the executed command in a particular memory that is known as history.

3. History command:

It is a command that displays the executed last 16 comment list with a particular number. It means we can display the executed command list. We can use the command number for executing the command without re-typing.

4. Exclamation(!):

It is a command that executes the previously executed command without re-typing. It means we can execute the existing command with the help of particular number. In this, we pass command number for execution.

5. r command:

It is a command that also executes the existing command same as exclamation sign. In this, we pass command number for executing. It is basically used in Korn shell. We use -and any value for executing last executed commands.


Command Line Expansions:

The command is defined at the command line and also execute output. The values are also used on the command prompt on the base of given command.

1. Tiled Expansion:

It is a feature that inherits from the C shell. It is basically used to manage the reference of the directory file inside a particular directory. The ∼ identify symbol for locating the particular directory or files.

2. Command and braced sets:

The besh shell uses a special feature relating to expansion which improves the power of working at a command line. We use $() is used to print the output or particular command which are passed into the given (). The command line returns the output of given command into the braced.

3. File command:

It is a command that checks the file from the particular directory. We can display multiple files together using this command.

echo”the date is”


echo file(1,2,3).

4. Command editing tricks:

Linux system allows us different types of keys for editing the command line processing. The default keys binding in the besh same as VI styles.

ctrl+A to move the cursor belonging to line

ctrl+E move the cursor at the end of the line

ctrl+U delete the beginning of line

ctrl+K delete to end of line

ctrl+arrow keys  move left or right by word.

About the author



Click here to post a comment