In this article I want to share my experience of maintaining and improving my dotfiles over roughly a year. Everywhere I go, or new computer I set up, I can quickly clone the git repository and fire up my bootstrap script to wire all the symlinks, aliases and scripts to form the console environement in which tools are familiar and I am efficient in solving tasks.
In the process, I gained more general experience with the Unix shell as well as tricks and hints from other developers and shell hackers. Normaly dotfiles only include configurations, but I want to show you what else you can do with your dotfiles.
Tools of a Craftsperson
When I am thinking of a craftsperson, I associate him or her with the tools the person uses for the job. A painter has a collection of painting brushes, like an electrician has a toolbox with screwdrivers and measurement devices and so on. Just like streamlining, simplify and organize, a factory process in order to increase its effiency, the same applies for processes in a virtual environment, in this article, the shell.
You will never change your life until you change something you do daily. The secret of success is found in your daily routine. John C. Maxwell
Shaping the Tools
As a developer you have your favourite applications, commands and routines. Further, you are writing lots of new programs, which solve different domain problems. Working with the computer gives the developer also the power of shaping his or her own tools. There are always ways to do a shortcut, doing things faster or more elegant. Some workflows can be automated by a simple shell script. In the end, you are faster performing repetetive tasks, and can use the saved time to focus on what is important. I already wrote a blog article about how you could refine your tools, so I will continue to unpack my digital backpack (or toolbox), my dotfiles.
Dotfiles are just a way, how to store all configuration into one folder and symlink them into your home directory, so that the applications can access them. But where to store your dotfiles, to get them whereever you go? Personally, I store my dotfiles in a private git repository. Storing them in a repository has the advantage that you can add or modify alias, scripts, configuration and so forth, whereever you are, and keep them in sync on multiple machines.
Okay, I wrote a lot about what the advantages of maintaining dotfiles are, but havent yet wrote a single word, what I personally store or sync over multiple machines. In other words, now follows the interesting part. I maintain fonts, wallpapers, templates for latex documents, project skeletons, as well as scripts and custom libraries, which I regulary use on the command line.
Furthermore, I maintain a folder, with files including snippets of shell scripts or text which I often use, and instead of cat, grep and replacing via e.g. sed, I write a function to fill the variables. Depending on the machine hostname I am operating on, I even have different implementations for the same alias. That way, I can easily adapt my dotfiles for different machine configurations.
I hope that I inspired you to write your own digital backpack. In the end, I want to refer to some interesting resources. For mastering the command line, I like to refer to this collection of best practices of using the shell. Command line fu is also a good resource to find inspiring one-liners. If you just started with shell scripting, explain shell might be a good resource explaining scripts. And last but not least, the subreddit command line on Reddit.