If you often find yourself having to type long commands in the terminal, this tip could be very useful.
For example, to activate my virtualenv I usually have to run something like
$ source ~/.venvburrito/startup.sh
I've substituted that for just
$ activenv
To do this, all you have to do is edit your bashrc file
$ sudo nano ~/.bashrc
Scroll to the bottom and add your alias by adding a line like so..
alias activenv="source ~/.venvburrito/startup.sh"
In this manner you can add multiple aliases. Just make sure to name them wisely and not cause conflicts.
Save and quit (Cntrl+X > Y > Enter) and you're done!
Restart terminal and you should have your new command available to use!
Ref: http://lifehacker.com/270799/create-terminal-shortcuts
For example, to activate my virtualenv I usually have to run something like
$ source ~/.venvburrito/startup.sh
I've substituted that for just
$ activenv
To do this, all you have to do is edit your bashrc file
$ sudo nano ~/.bashrc
Scroll to the bottom and add your alias by adding a line like so..
alias activenv="source ~/.venvburrito/startup.sh"
In this manner you can add multiple aliases. Just make sure to name them wisely and not cause conflicts.
Save and quit (Cntrl+X > Y > Enter) and you're done!
Restart terminal and you should have your new command available to use!
Ref: http://lifehacker.com/270799/create-terminal-shortcuts
No comments:
Post a Comment