![]() |
![]() |
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):
...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 |
The Newbie's Linux Manual is reproduced on LinuxMall.com by permission. The Newbie's Linux Manual is written and maintained by Laurence Hunter. You can find much more of Laurence's work at his site: www.Linuxdot.org |
© 1999 Linuxdot.org | Manual's Copyright Terms