by Drbongo - founder of Vinux
When in the terminal, either gnome-terminal or a console, all interaction with your computer requires typing. Sometimes the amount of typing required can be tiresome. To help with this you can create and use aliases.
Aliases are stored in your home directory in a file called ".bash_aliases". Aliases are in the format:
alias shortcommand='long command goes here'
Note:The apostrophes may be replaced with quotation marks ("). When you have added a new alias you can then type the short command and get the same output as if you had typed the longer command.
Aliases can also make commands behave differently from the way they would normally. If you would like to execute something in its normal way without its alias type a backslash "\" before the command.
by Storm Dragon
When you type 'date' from the command line you will get something like this:
Tue Nov 30 18:32:55 EST 2010
I wanted to display the date in a more friendly format. Here are the steps for adding this bash alias to your system:
nano ~/.bash_aliases
Nano will open with a text file that may or may not be blank.
alias date="date +'%I:%M%p%n%A, %B %d, %Y"
With the alias in place, when you type
date
you will now get something like:
06:33PM Tuesday, November 30, 2010
Note:Remember, if you would like the original format just type:
\date
One final thing, after you have added a new alias, before you can use it, you need to reload things so that bash will know about your new creation. To reload everything either exit the terminal and restart it or type:
source ~/.bashrc
The new alias will now work as expected.
If you want to avoid duplicating an existing command, capitalize the first letter of your alias.
Vinux comes with a bash aliases file. This is a list of aliases that can simplify the use of many common commands and their related options. It is informative just to view the list to understand what aliases can be used for.
These aliases are not enabled by default. If you would like to try them simply run the following code in a terminal:
mv .bash_aliases_vinux .bash_aliases
This moves the Vinux aliases to the file where bash aliases are stored.
alias
Press "enter".
a
the alias for alias.
alias alias-name
Peter Tesar and Rill contributed to this article.