BASH

BASH is a Unix command shell written for the GNU project. Its name is an acronym for Bourne-again shell —a pun on the Bourne shell (sh), which was an early, important Unix shell. The Bourne shell was the shell distributed with Version 7 Unix, circa 1978. The original Bourne shell was written by Stephen Bourne, then a researcher at Bell Labs. The Bash shell was written in 1987 by Brian Fox. In 1990, Chet Ramey became the primary maintainer. Bash is the default shell on most Linux systems as well as on Mac OS X Tiger, and it can be run on most Unix-like operating systems. It has also been ported to Microsoft Windows by the Cygwin project.

Taken from Wikipedia - http://en.wikipedia.org/wiki/Bash

Contents

BASH in the G-Bar

Bash is the default shell in the G-Bar and is the program which starts with a terminal. A reference and example usage can be found on the introduction to UNIX commands page.

Bash Tips

Shortcuts

^ = CTRL (in most cases)

^a
^e
^w
^u
^r

and type what you are looking for.

^d
^l

Aliases

An alias is a quick way of substituting a command for something else. On the G-Bar system aliases are used to make rm (remove file), mv (move file), and cp (copy file) interactive. That is, they will prompt for confirmation before removing (deleting) or overwriting a file.

The aliasing is done in your local .bashrc file:

alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"

If you want to e.g. delete a whole directory, the command would normally be

rm -r directory

('-r' for recursive) but because of the alias above rm will confirm deletion of each single file, making it very tedious to delete the whole directory. To quickly bypass this interactive confirmation, two solutions exists:

/bin/rm -r directory

or

\rm -r directory

The backslash cancels the alias, calling the original command instead. If some files are write-protected, rm will still ask for confirmation. To eliminate this, use the '-f' flag for force, e.g.:

/bin/rm -rf directory

.bashrc

source ~/.bashrc