Share single .bashrc across multiple linux machines

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

https://gist.github.com/spuder/11360474

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;

https://gist.github.com/spuder/11360447

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.

    spuder@Spuders-MacBook-Pro:~$ bashupdate

Open a new terminal, or source your ~/.bash_profile and you will instantly have the new changes. Pretty slick right?

Advertisements

About spuder
spuder is a "super computer" support engineer by day, and tinkerer / hobbyist by night.

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

%d bloggers like this: