On Wednesday 03 April 2002 10:26 am, Jesper Nyholm Jensen wrote:
> Hi,
> How do I create aliases in the bash shell?
First type 'alias' in a terminal to see what you've already got.
Then, I make the aliases I want to add in /etc/bashrc to make them
global to all users (me ;) As root just use a text editor to add 'em
to the end of bashrc For example, putting in this line
alias loci="locate -i"
will enable 'loci' to do a case insensitive search for whatever you
type after 'loci', eg 'loci mandrake' will find all instances of
either Mandrake or mandrake.
With all aliases, they won't take effect till you start a new
terminal. With my example, you're slocate DB will need to be
current. To update it, type 'updatedb'. I use this alias to do a
bunch of updating all at once
alias updall='rpm --rebuilddb && updatedb && ldconfig -v'
There's other ways to add aliases, but I find making them global
in bashrc is easiest, since I only need to save /etc/bashrc to
instantly make them available to a fresh install by just coping in my
bakup bashrc to /etc. Basically, anything you can do on the command
line, can be shortened to a few characters, by just adding
alias <some charaters>="the command you want" to etc/bashrc to
save typing, and you only have to get it right once ;) Just remember
to surround the "the command you want" with either double (") or
single (') quote marks when you add it to bashrc.
--
Tom Brinkman Corpus Christi, Texas
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com