April 27, 2014 Leave a comment
Often I manage many servers and find myself wishing I had the same shortcuts available on my workstation, also present on the server.
Normally I’d use puppet to manage the .bashrc or .bash_profile, but my workstations don’t have a puppet master. To work around this, I store my .bash_profile on github, and have a script to update it automatically.
Here is the script to update my bash_profile
#!/bin/bash curl -L https://gist.github.com/spuder/11360474/raw/ > ~/.bash_profile
The actual bash profile is located here
alias ls='ls -G' alias sl='ls -G' alias up='cd ..' alias redo='sudo \!-1' alias sdou='sudo' alias suod='sudo' alias sodu='sudo' alias tailf='tail -f' # Open sublime text editor with command subl if [ ! -f /usr/local/bin/subl ]; then /bin/ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl; fi;
Now on every machine I manage, I run the following command just once
curl -L https://gist.github.com/spuder/11360474/raw/ | bash -x
After that, I can just execute the bashupdate alias to pull down the latest version.
Open a new terminal, or source your ~/.bash_profile and you will instantly have the new changes. Pretty slick right?