The bash shell:

Sh:      Bourne shell, developed by Steven Bourne in AT & T lab.

-A traditional unix shell.

Csh: C shell, C programming language was used.Developed by Bill Joy

(many features such as:

-command line complition

-command line editing

-History of command for each user is mantained.

Ksh: Korn shell developed by David Korn at AT & T lab.

Bash shell: The Bourne again shell is the Linux standard command line interpreter.

It was developed by GNU project and has Captured all the good features of ‘sh’ and Korn Shell.

– for more help #man bash

to see the current shell

#echo $SHELL

History for the command for each user.


for history file

# /.bash.history

#!! 9repeats the previous command)

#!n (repeats command which is in line number ‘n’ in history file)



#!m (repeats prevous command starting with m)


#!-N (repeats command executed ‘n’ command back)

eg. #!-23 (repeats command entered 23 command back)

bash use of wild card character:

? Matches a single character

* Matches all characters

[a-z]     Matches in the range a to z

[^a-e]   Doesn’t match in the range a to e

[be]      match in the set b and e

[^be]    doesn’t match in the set n and e

#rm -rf [^a-d]*

bash contined…

#mkdir /var/xyz/test (it could not create test dir if not exist /var/xyz)

#mkdir -p /var/xyz/test (also creates the parent directories)

#mkdir -p /var/hmg/ministry/{home,finance,agr,health,def}/{sec,officer,executives}

#cd ../finance;ls

Command alias


eg. find /-name grub -and -user root

alis search=’find / -name  grub -and -user root’

Use of quotes:-

‘ Single quote: Treats everything even a special character as ordinary character./

” Double quote: Expands the especial characters.

` Backquote: Command can be executed



Two types of variables

1.         Local shell bariable: Available to the current shell only

2.         Environment variable: Available to the current shell as well as sub-shlls.

#env – displays env. shell variable only.

@set – displays both local and env. shell variables.

#ps – displays the current running(foreground) process

#/home/.bash_profile- Containms user-specific shell variables

/etc/profile – contains system-wide shell(globally) shell variables.

#export (variable name) – to make the variable env. variable.

eg. export myvar



#echo $myvar




#echo $myvar