Improving your workflow with aliases

Just after updating my Mac OS X Yosemite to El Capitan I noticed all my aliases have gone away. Since I had to rewrite my workflows I decided to write about it here.

If you do more than browsing websites and watching movies on your mac, you probably have met the terminal. Through this article I want to show you how I improved my workflow by the use of aliases.

What are aliases?

Aliases are simply shortcuts to commands. I use then to just quickly access some files, logs, ssh and such.

I grabbed some of those around the internet, of course. And you can grab any of mine here if you want. Don’t be shy.

To add aliases, just grab your favorite text editor and edit the ~/.bash_profile file.

vi ~/.bash_profile

And just write your alias like this:

alias NAME-OF-THE-ALIAS=”COMMAND”

These are the ones I use more often. Those .sh are for connecting to some of my amazon servers using ssh, even granting access to my ip current IP in the security group, but it’s subject to another post.

alias pmotapplication="sh /Users/rafael/mot-application-prod.sh"
alias pmotdatabase="sh /Users/rafael/mot-database-prod.sh"
alias motapplication="sh /Users/rafael/mot-application.sh"
alias motdatabase="sh /Users/rafael/mot-database.sh"
alias errorlog="tail -f /Applications/MAMP/logs/php_error.log"
alias mamphtdocs="cd /Applications/MAMP/htdocs"
alias goto_transfers="cd ~/Downloads"

And these are great ones I found at http://www.shellperson.net/using-sudo-with-an-alias/

alias sudo="sudo " 
# This alias recursively destroys all .DS_Store files in the folder I am currently in
alias killDS="find . -name *.DS_Store -type f -delete"
# Mac get stuck very often and are extremely slow and unstable on shutdowns. This forces a shutdown.
alias forcepoweroff="sudo /sbin/shutdown -h now"

Comments

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *