Using the alias command under GNU/Linux

Sometimes when you use the BASH Shell under GNU/Linux it happens that you have to use the same command many times and you don’t want to look in your history every time. With history and a pipe to grep you can find your command really quickly to use it again. For example you want to find the last mount commands in your history you use:

$ history | grep 'mount'

However if you are using the same command frequently and you want it to give this particular command an alias. You set the new alias with

$ alias pictures='cd ~/Pictures'

To find out which aliases are already defined just type

$ alias

REMEMBER: After starting a new session this alias won’t be available anymore. If you want to set permanent aliases you just write them in your ~/.bashrc.

alias pictures='cd ~/Pictures'
alias vi='vim'
alias ..='cd ..'

If you want to remove an alias because you don’t use it anymore you can do that with unalias.

$ unalias pictures

I think that alias is a really useful bash command which can save time because you have to type less.