Aliases for commands in the terminal

I see a lot of pages with information about how to setup the aliases for the terminal but some put them on the .bashrc file and I always though that it should be a better (more organized) way. And there is.

If you want to alias your commands just create in your home directory a .bash_aliases file
vim ~/.bash_aliases

And put your aliases there with the following notation.
alias newcommand='oldcommand'

For example now that I’m working with vagrant I was seing myself typing a lot of times things like “vagrant up”, “vagrant halt” and “vagrant ssh” so I created 3 aliases for those commands

alias vu='vagrant up'
alias vh='vagrant halt'
alias vs='vagrant ssh'

Now I just type “vu” to run the vagrant box, “vh” to stop it and “vs” to access it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s