Bourne Again SHell
Bourne Again SHell


The Bourne Again SHell (bash) is a public domain shell written by the Free Software Foundation under their GNU initiative. It is intented to be a full implememtation of the IEEE Posix Shell and Tools specification. It is widely used within the academic community and is the default shell on most versions of Linux.

Bash provides all of the interactive features of the c shell and the Korn shell. Its programming language is compatible with the Bourne shell. If you use the Bourne shell for shell programming you might consider using bash as your shell enviroment. See Summary of Shell Facilities.

Bourne Again SHell Files
On login, bash sources the users .bash_profile if it exists. If it doesn't bash next checks if the user has a .bash_login and sources it. It it also doesn't exist, bash sources the users .profile.

On starting other non-login shells bash sources the users .bashrc.

Below is one very simple .bash_profile

source $HOME/.bashrc

Below is an example of a .bashrc.

PATH=/usr/bin:/bin:/usr/local/bin:.
MANPATH=/usr/man:/usr/local/man

MAIL=/usr/spool/mail/$USER
PRINTER=XXX			# Replace XXX with your 
				#  favorite printer
PS1='\u \h> '
NNTPSERVER=YYY			# Replace YYY with the
				#  name of your newserver
EDITOR=emacs
HISTSIZE=100

source ~/.aliases.bash		# One way to set aliases

Below is an example of the .aliases.bashrc.

alias c='clear'
alias cp='/bin/cp -i'
alias mroe='more'

If a line has a "#" in it, all of the rest of the line is treated as a comment. Note that in PATH commends directories are seperated by a ":". Also note that the current path is indicated by a ".". For more information on the Bourne Again SHell try man bash.

Bourne Again SHell Commands
Shell Command Action
alias [name][command] Assign name as the alias for command
bg place the current job in the background
bye n exit the shell with exit status n
echo string Write string to standard output
exec command Execute command in place of current shell
exit n Exit the shell with exit status n
export variable Export variable to subsequently executed commands
fg [option] Place the job listed in [option] in the foreground as the current job
history Display the list of history events
jobs [options] Display a list of active jobs
kill [options] pid Terminate the designated process pid
set [variable [n] [=value] Set variable to value
suspend Stop the shell
unalias name Remove name from the alias list
unset name Remove enviromental variables that match specified name