Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I work on several different machines, all of which are *nix. I have a lot of specific things I like my shell to, or the prompt to look like, or aliases, etc, etc. I'm sure all of you folks deal with this as well.

What do you think the best way to keep all my machines' shells to act the same?

First off, I'm aware that different machines will need different paths to bins and other differences, so my first inclination is to just include a file at the end of my profile, this is the one that we'll keep in sync.

What is the best way to keep files synced up? I can put the file on a remote system, and perhaps use git, to push, then pull my changes every once and a while. However, isn't Rsync better suited for this?

share|improve this question
    
I apologize ahead of time if this is just a dumb question... –  Joseph Silvashy Jun 15 '10 at 4:49
2  
Not dumb at all. –  Dennis Williamson Jun 15 '10 at 7:12
add comment

3 Answers

up vote 7 down vote accepted

This is how I do it:

  1. I never put real content on the ~/.bashrc or ~/.bash_profile files, instead those files are just symlinks to the real configuration files kept in a subdirectory in my home folder, for example ~/dotfiles/bashrc and ~/dotfiles/bash_profile.

  2. I keep the ~/dotfiles folder under source control using Git, and hosted at GitHub.com

  3. When I install a new system, I just clone the GitHub repository to a new local ~/dotfiles folder and create all the symlinks (currently by hand, though this step should be easy to automate).

  4. I use this same procedure for other config files, like .hgrc (for Mercurial), .vimrc and several others.

  5. Whenever I edit one of the configuration files, I just commit and push to GitHub, and then pull in every other machine.

This is still somewhat laborious and manual, but I've been happy with it.

This is the current content of my ~/dotfiles folder:

~/dotfiles
|-- bash
|   |-- aliases
|   |-- config
|   |-- env
|   `-- promptcolors
|-- bash_profile
|-- bashrc
|-- gitconfig
|-- gvimrc
|-- hg-templates
|   |-- map-cmdline.dlog
|   |-- map-cmdline.nlog
|   |-- map-cmdline.sglog
|   `-- map-cmdline.slog
|-- hgrc
|-- ssh
|   `-- config
|-- vim
|   |-- after
|   |-- colemak-mappings.vim
|   |-- colors
|   |-- doc
|   |-- filetype.vim
|   |-- ftplugin
|   `-- plugin
`-- vimrc

I stole this idea from the great Peepcode Advanced Command line screencast (worth the $9 in my opinion).

And this is where I keep my GitHub repository, in case you want to take a look. Don't expect anything of great interest, I'm just a bash/command line newbie.

http://github.com/sergio/dotfiles

share|improve this answer
add comment

Another option is to use Briefcase. In short, it automates the solution that Sergio outlined of having a separate folder for the real files and symlinking them into your home.

However, an excellent it also includes an excellent security feature for keeping sensitive information out of the git repository (as it should be!).

share|improve this answer
add comment

You could try http://alias.sh

It's a free service to manage and store your aliases online. You can then sync directly to all of your machines.

share|improve this answer
2  
The OP wants to store their shell configuration files, which typically consist of much more than just aliases. –  slhck Jan 16 '13 at 13:54
    
Yeah fair enough, thought it may have been useful when I saw the question which popped up while I was searching. I'm just glad that down vote didn't put my rank to 0 :) –  user190433 Jan 16 '13 at 13:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.