Bash Aliases

Bash Aliases

This is a short post to tell you to create more bash aliases.

I have had one for my devops setup for a while because I have to set several environment variables to get just about anything done. More recently, though, I set up a few more for my main Django project and even this blog. For the blog it's a simple as entering the directory and activating the environment:

alias pmlstart='cd ~/pml_blog && source env/bin/activate'

For the Django project, it took me forever to remember how to start my local postgres instance (is it service start, or start service, or...?), so I finally just made that part of an alias for when I start working on the project:

alias webstart="cd ~/website && source env/bin/activate && sudo service postgresql start && source env_vars.sh"

Since writing this, I added that last piece to it to load environment variables into my environment so I don't have to remember to edit my activate file when I need to recreate my environment locally. Highly recommended!

Are there bash commands you use frequently together? Make an alias!