HOWTO: Bring Your Dotfiles Under Version Control

For the uninitiated, dotfiles are configuration files for various applications in Linux (such as Vim, tmux etc.). Unless you work and play on one single system all your life, chances are that you’ll want to “move” your work (or play) environment from system to system in as painless a way as possible.

To make matters worse (or better, depends on how you look at it), dotfiles change. And when you add that neat new Vim key binding to your .vimrc, you expect the .vimrc’s in all your other machines to get updated as well. You can only copy files around for so long before you give up and Google for “how to bring dotfiles under version control” and end up reading this post.

Anyway, if you haven’t guessed already, Version Control Systems (such as GIT, SVN etc.) are an excellent solution to this problem. The only problem is: dotfiles are scattered around all over the place in your home directory. How do you bring them all under one roof so that GIT (or SVN) can work its magic? You definitely don’t want to bring your entire home directory under version control just for a few dotfiles.

Note: There are a number of possible solutions to this (I’ll go out on a limb and say that that Google search pointed to more sites than just mine)  – and the one I describe in this post is simply one that has worked out well for me over the years. YMMV.

So, without blabbering on further about why you need this, I’ll get right to it.

Step 1: Set up a GitHub Repository

The first step is to create a repository for your dotfiles in GitHub (if you don’t have a GitHub account yet, now’s a good time to create one).

Note: You can use any other Version Control System for this HOWTO as well, if you so please. Just change the Git commands to your system’s equivalents.

Let’s call the new repo, unimaginatively, ‘dotfiles‘. You can choose to create the README file when creating the new repo, it’s up to you. Doesn’t matter for this HOWTO.

While you’re at it, it’s also a good idea to set up access to the account using SSH keys from your different machines. A good tutorial is available here.

Step 2: Move dotfiles to a Common Folder

We’ll be storing all your dotfiles in one common subdirectory. So let’s set that up.

  • Create a directory ‘dotfiles’ in your home directory
    $ cd ~
    $ mkdir dotfiles
  • Move your dotfiles to this directory like so:
    $ cd ~
    $ mv .vimrc dotfiles/ [Note the slash at the end]

    Similarly, move all your other dotfiles to dotfiles/

Now, let’s move all these new files in dotfiles/ under version control:

$ cd ~/dotfiles
$ git init
$ git commit -a

The last command (git commit -a) will open up an editor window. Type your initial commit message (something like “Initial commit – adding dotfiles”), save and exit the editor. All your dotfiles are now staged and ready to be pushed to the repository like so:

$ git remote add origin
$ git push origin master

That’s it! Your dotfiles are now safely stored in version control.

Step 4: Write and Check In Setup Scripts

All the dotfiles are now in version control. They’re no longer in your home directory anymore though. So is all that we’ve done an exercise in stupidity? Of course not!

In this step, we’ll write scripts that create symlinks of your dotfiles (which now reside in ~/dotfiles) and place them in the correct locations within your home directory. So let’s do that.

$ cd ~/dotfiles
$ vim

In the editor, type out the following:


cd ~/dotfiles
ln -s .vimrc ~/.vimrc
ln -s .tmux.conf ~/.tmux.conf

You’ll need to put a separate ‘ln’ here command for each dotfile that you put under version control.

Once you’ve filled in the file, let’s check that into version control as well:

$ cd ~/dotfiles
$ git add
$ git commit -m "Adding setup script"
$ git push

Don’t forget to execute on your own system!

$ cd ~/dotfiles
$ ./

Step 5: Migrating to New Systems

Now let’s talk about the main reason why we went through all this hassle: migration to new systems and keeping versions on different machines in sync.

Moving to a new system: On a new system, all we need to do is:

$ cd ~
$ git clone
$ cd dotfiles
$ ./

And we’re done. All the relevant symlinks will be created and life will be good.

Updating dotfiles: Whenever you make a change to any dotfiles, simply do:

$ git add [name-of-dotfile]
$ git commit -m "Commit Message"
$ git push

And an updated version of your dotfile(s) will be stored on GitHub. On the other systems, you do:

$ cd ~/dotfiles
$ git pull

And the updated dotfiles will be available immediately on your other systems.

If you add a config file, you’ll have to:

$ cd ~/dotfiles
$ git add [name-of-dotfile]
$ git commit -m "Commit Message"
$ git push

And on the other systems,

$ cd ~/dotfiles
$ git pull
$ ./

And you can get back to work!

Hope this little HOWTO helped. If you’ve got any comments/feedback, feel free to post them in the comments section!


Go Fish

I changed my shell. Yet again.

This time it’s called fishfish. Funny name, but a great shell, nevertheless.

It’s a fork of the famous(?) fish shell and it has been beefed up with some nice features like autosuggestions (that aren’t a pain in the arse, for a change), syntax highlighting and a web configuration script. It’s pretty fast too. Give it a try here.

There are a few things to keep in mind though if you are switching from BASH. For example, .bashrc cannot be directly copied to fishfish’s config directory. This and some other subtleties are explained in their FAQ.

Give it a spin and see how it feels. I myself have moved to fishfish for good (yeah, how many times have we heard that before, right? :P).

Update (June/2013): One year later, I can safely say that this is *still* the best shell I have ever used. I don’t think I can ever go back to bash. Oh and BTW, I would highly recommend that you use the version available in their GitHub repo. The reason being that the downloadable tarball on their site is usually not up-to-date.

Wow. Things looketh different here.

Ah. Long, long time. * flexes fingers *.

Looks like tekguru has been on hiatus for over 2 years now. Wow. Never thought I’d be this busy. Or rather, this ignorant about my lovely blog. 🙂

Anyway, a LOT of things have happened in the interim. Far too numerous to list here in entirety. For starters, I moved to the U.S. for my graduate education (ha!), and I’ve spent a while in this wonderful place. A year and a half, to be precise.

Research has turned from merely being an “option” for me to being my full-time occupation. In case anyone is interested, I still work on Compilers, albeit with some Parallel Programming stuff and Auto Parallelization thrown in.

Technology-wise, well, how can things NOT change technology-wise if you move to the U.S of A? I bought my first smartphone a while back (a Motorola Atrix), a MacBook Air (ooh yeah! Review coming up soon.. hopefully), and *quick glance around room* of course, my beloved new DSLR (a Nikon D90) to name a few. On the operating systems side, I have switched to Mac OS X Lion (duh) and am loving it (again, a post on this soon hopefully). Other than that… ah never mind. Let’s keep the rest for another day/post.

That’s it for now I guess. I’m glad I decided to “randomly” log in to wordpress and see if they have deleted my account yet. Good to know they haven’t. Hopefully, I’ll take the hint and start blogging again. But then again, how can I promise something when doing a PhD? Perhaps I could blog about grad life (I know what you’re thinking.. I know). Hmm.. well let’s see.

rTorrent Cheat Sheet

Note: If you’re in a real hurry, the link to the cheat sheet is given at the end of the post. Enjoy!

In my quest for that perfect Bit-Torrent client for Linux (read: one that supported scheduling :)), I stumbled upon countless worthless ones. Only one managed to impress me.. and it was NOT uTorrent.

uTorrent (on Wine of course) seemed to fit the bill perfectly – but then scheduled downloads mysteriously failed to complete. Only god knows why. So off I went in search of a better solution..

.. and that’s when I came across rTorrent. I’ve always like CLI solutions to problems (even when that pretty GUI client slaps you in the face and reminds you it’s there) and rTorrent’s minimalistic but powerful features impressed me. It supports scheduling, of course.. (albeit not in as elegant a way as some other solutions) and the learning curve wasn’t too steep either. Besides, it was optimized for high performance and the creator claims a 3x improvement in seeding speeds.. Phew!

In case anyone is interested, the first rTorrent resource to check out is the official website. The man-pages are somewhat outdated (especially some keyboard shortcuts which haven’t been updated in a while). Read the official User Guide here.

Scheduling is accomplished using the schedule = option in the main config file (.rtorrent.rc in your home folder). For BSNL night-birds, the following commands may prove useful (this is what I have in my .rtorrent.rc):

# BSNL Scheduling...
schedule = night_dl,03:00:00,0,download_rate=0
schedule = night_ul,03:00:00,0,upload_rate=48

schedule = peak_dl,08:00:00,0,download_rate=1
schedule = peak_ul,08:00:00,0,upload_rate=2

Just to be clear, download/upload rate of zero turns off throttling, it doesn’t throttle the rate to zero. Also, check out the man-pages for info on the format and the meaning of the various parameters for schedule.

Finishing off, I’d like to add that I’ve made a little “cheat sheet” or quick-ref card  for rTorrent . Do check it out and send in suggestions!

rTorrent Quick Reference Card [pdf]

Freedom At Last!

After 5 months of trying out umpteen different distros, Jaunty is finally working as expected! My Intel WiFi device was detected instantly and after installing the nVidia drivers, brightness controls are working flawlessly as well.. I couldn’t be happier! 🙂

The only remaining issue is getting the brightness function keys to work, but that’s no biggie.. I can live without that. The important thing is that I can bid Vista buh-bye and get back to Linux… finally!

About Jaunty, it’s a wonderful distro, no doubt. Probably the best I’ve ever used… It boots so quickly that I almost fainted the first time around. The overall performance seems to have improved too, and not to forget the user-friendliness part – Canonical seems to be putting in a lot of effort into this aspect. Plus I chose to use the all-new ext4 file-system which is working great as well.

It’s hardly been a day since I installed it, and Jaunty has managed to impress me quite a bit. Let’s hope things don’t go wrong in the coming days.. You never know!

Here’s a screenie of my current desktop:

Jaunty Screenshot

And here’s a link to my .conkyrc in case you’re interested..


After a surprisingly long break from the Linux world (about 5 months), it seems my woes are finally going to be over (Vista is torture. Period). With Jaunty released today, hopes are high..

The wireless card won’t give me any headaches… It’s the brightness controls (or the lack thereof) that will make or break my day. The Jaunty ISO is currently sitting in my download queue, waiting for the clock to strike 2 a.m. when it will finally start downloading. Fingers crossed…!!


On 27 December 2008, Windows 7 Beta was leaked onto the Internet. According to a performance test by ZDNet, Windows 7 Beta has beaten both Windows XP and Vista in several key areas, including boot and shutting down time, working with files and loading documents; others, including PC Pro benchmarks for typical office activities and video-editing, remain identical to Vista and slower than XP.

— Wikipedia.

Microsoft, as usual, is hoping that their next Windows version succeeds in the market. After the disaster that Vista was, it’ll take some mighty hard work (not to mention luck) on their part to get the ball back in their court.

A few years ago, owing to Vista’s failure, many regular computer users reverted to XP while the few adventurous ones gave Linux a try… a serious try. A still smaller fraction of the latter few actually liked Linux and decided never to turn back.

Now, if Windows 7 turns out to be even half as popular as XP, Linux adoption will again take a back seat – the process has already started IMO, judging by the popularity of the Beta. People will upgrade their XP machines saying “Finally, the Windows version that I was waiting for has arrived!”.

Meanwhile, the Linux and Open Source community will go on about their jobs, slowly but steadily creating software that’s far superior to anything that the corporate world could ever hope to produce.

And one day, many years from now, Microsoft will screw up again… perhaps with Windows 10. People will get a 2 or 3 year hiatus where they’ll have a choice to either stay with Windows or move onto Linux. Some will move on – in fact many will move on, since Linux will have become so much better by then.

And before long, Microsoft will bounce back – and they’ll still get users that upgrade their PC’s and be all fired up about switching to a newer version of Windows (humans!). But this time around, the numbers will be smaller.

The cycle will go on… but not unto eternity. Very soon, Microsoft, or any other software giant for that matter will struggle, trying to keep up with the elephantine OSS movement. Acts of desperation… until one fine day, a long way away from now, the world will mourn the death of Windows.

Ah! What a theory! I’m so proud of myself… *sob*

Too bad I’ll be dead before anyone even thinks about “The Year of the Windows Desktop”.. if you know what I mean.