dotfiles. Why you should use them.

A few weeks ago I even did not know what dotfiles are and how they can make my day-to-day work more efficient.

What is it about?

The main idea behind dotfiles is customization. You can customize almost everything from basic operating system variables to your editor config and then share the settings between multiple machines.

It is almost sure that during your life you will use different devices so it is really profitable to spend some time on preparing custom dotfiles and extend them with time.

How to start?

A common way of storing the files is having GitHub repository called dotfiles. Github itself has a guide that explains an idea in details and lists popular dotfiles repositories that you can fork and modified to your needs.

My approach

For me, example dotfiles collections available on GitHub were too complicated for the beginning so I decided to create two most desirable files and I will probably create new ones when needed.

The first file that I created was `.bash_profile` and it improves my day-to-day work much, mainly due to custom aliases. They allow to run commands in a terminal in a shorter way.

“`bash
alias ..=’cd ..’
alias l=’ls -all’
“`

After defined, to see all files in a current directory I just need to type `l` in terminal.

`.gitconfig` is used for defining global config for Git. I saw files with more than 200 lines of codes and it didn’t work for me. I created a basic one with settings that I really need and understand. You can just start with defining two basic, but important variables.

“`bash
[user]
name = Igor Springer
email = [email protected]
“`

`.gitconfig` is also the most proper place for defining git aliases, but I personally decided to define them in `.bash_profile`, because then they are shorter.

“`bash
alias gc=’git commit’
“`

To commit recent changes I type `gc` instead of `git commit`.

Just think how many commands you type every day.

Summary

You can check my repository with the files here.

What is your opinion about dotfiles? Do you use them? Do you think that spending some time on configuration now will give benefits in the future?

 

Igor Springer

I build web apps. From time to time I put my thoughts on paper. I hope that some of them will be valuable for you. To teach is to learn twice.

 

Leave a Reply

Your email address will not be published. Required fields are marked *