Linux Mall - The Linux SuperStore!
Linux books, Linux CDs, Linux toys, you name it, they have it!

W W W . L I N U X D O T . O R G

Newbie's Linux Manual
Shortening All Those Huge Commands: Aliases
by Laurence Hunter
[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
Taylor-made Commands

Yet another great example of the overwhelming scope of customization available to you in the World's best OS. Why have a long command when a short one will do.

- 1 -

Logged into the account you want the aliases to be for, enter:

cd
pico .bashrc
Note:

Enter: pico /etc/bashrc instead if you want to create global aliases that every user can issue. Obviously you'll need to be root to do this, and global aliases will override local aliases with the same name.

- 2 -

Enter the following (aliases indicated in bold, which you can call whatever you want):


alias x=startx alias ls='ls --color' alias pico='pico -w' alias howto='netscape /usr/doc/HOWTO &'

...and press Ctrl+O to save and Ctrl+X to exit.

Note:

Using the semicolon (;) you can have an alias run multiple commands! Here's a few examples (the second being a little extreme):

alias cls='clear; ls'
alias lswin='mount /mnt/c ; cd /mnt/c/windows/desktop ;
clear ; ls ; cd - ; umount /mnt/c'

- 3 -

Either log-in again, or enter:

. .bashrc

...to have bash accept the changes.

Now for example, whenever you enter: ls the list will be in colour, or when you enter: x you'll enter the X Window system.

Note:

If you edited the ~/.bashrc in X, you'll need to enter: . .bashrc again after you've logged out of X.

[ Home ] [ Contents ] [ Download*] [ Previous ] [ Next ]
* In Linux enter: unzip nlm.zip
Homepage | The Last 5 Days | The Daily Linux News | The Linux Bits | Newbie's Linux Manual
The Best Linux Sites | Linux Book Reviews | A Windows Vendetta?
Diary of a Linux Newbie | Diary of an Open Source Newbie
The Linux Forum | Just For Fun
Amazon - The World's Biggest Bookstore!
4.7 million books, CDs, videos, and DVDs available to buy!
© MM Linuxdot.org | Webmaster | Manual's Copyright Terms