Starting Your Own Dotfiles
What the heck are dotfiles, and why should you care?
If you’re familiar with Unix/Linux operating systems you may have opened up a terminal and looked at all of the various files within your home directory. You may have even viewed and edited a few of them, like a
.vimrc. Here’s an example of what your home directory might look like:
So what exactly are these “dot” files?
To start, the dot or ‘.’ in front of the file means that it is actually a hidden file on the system. So to actually see these files, you either have to enable the ability to view those hidden files (if you are using a gui file viewer) or you have to use a specific flag (
-a) on the command line with
Frequently, applications like vim, bash, zsh, irssi, etc use these hidden files or directories as a way to store user specific configurations.
So why should you care?
Having a dotfiles project provides a quick way to stand up your operating system to configure it exactly what you want. Have any aliases that you can’t live without? Or perhaps you’re picky on how your vim behaves? Dotfiles also provide a way for you to sync and backup specific aspects of the tools you use across all of your physical and virtual machines.
In the tradition of dotfiles, I have shared a starter repo that I encourage you to fork onto your own Github profile. This starter repo is just the bare minimum. It simply installs a few basic tools depending on your OS, and then sets up the few “dot” files like a bashrc, vimrc, etc that you might want and expand upon. To set them up, follow the simple instructions below:
Clone my dotfiles into your home directory under the name
$ git clone https://github.com/briancain/starter-dotfiles.git ~/.dotfiles
cd ~/.dotfiles and run my simple installer bash script
It will ask you a few questions (like your favorite shell), and assume you wish to use vim :)
Syncing your changes
If you make any changes to your vimrc, bashrc, or zshrc, since those files are symlinked it will also update the repository. This comes in handy when you want to sync those changes to another machine. If you have made changes in your repository, simply
cd ~/.dotfiles and use git to commit those changes and push it up to your fork on Github.
If you have your own rc file that you would like to add to your repo, you can either manually symlink it or place it in the
~/.dotfiles directory without the ‘.’ in front of the name. Then if you re-run the installer it will symlink everything for you in your home directory. Placing it in your
~/.dotfiles directory allows for it to be uploaded to Github and synced across your machines.