Introduction to Shell

Unix

Share

What is Unix Shell?

Unix Shell is a command line interpreter that executes commands entered via keyboard or a script file.

How to interact with Unix shell?

Users can interact with Unix shell via shell program from the GNU Project called bash or Bourne Again SHell which is an enhanced improvement of sh, the original Unix shell program created by Steve Bourne.

In GUI or Graphical User Interface environment we use terminal emulator to interact with shell. The following image is of a terminal from Apple OS X.

Shell Prompt

When we start the terminal we get to see the following.


[yusufshakeel@linux ~]$ 

This is called the shell prompt and it indicates that the terminal is ready to accept command. The shell prompt consists of username @ machinename followed by the current working directory.

Superuser

If the last character in the shell prompt is a hash sign (#) rather than a dollar sign ($) then it indicates that the terminal session has superuser or administrator privileges i.e., we have logged in as the root user. The root user enjoys all the privileges. Whereas, a normal user is someone who enjoys comparatively fewer privileges.

sudo

How to enter into superuser or root user mode?

Its very simple. Open terminal and type

[yusufshakeel@linux ~]$ sudo su

The terminal will ask for the root user password. Enter the password and it will change the shell prompt to superuser mode


[yusufshakeel@linux ~]# 

How to close a terminal session?

To logout of a terminal session we either have to close the terminal emulator window or using the exit command.


[yusufshakeel@linux ~]$ exit