MonthFebruary 2019

Modular .bashrc

My previous .bashrc file was a mess, with way too much stuff inside one file, making it hard to manage. I decided to split it up and make it modular. To do this I keep my main .bashrc file really simple. The only thing it does is loop through the ~/.bashrc.d/ folder and running everything inside it.

<!–more–>

So the contents of my ~/.bashrc file is just the following:

for file in ~/.bashrc.d/*.bashrc;
do
  source $file
done

Then I keep all my small modular units inside ~/.bashrc.d/ folder. It looks like this:

├── activitystream.bashrc
├── default.bashrc
├── dotfiles.bashrc
├── git.bashrc
├── nvm.bashrc
└── pb.bashrc

You can see all of its contents here. Each file does one/few things well, so it’s really easy to add more units, remove or change them. I really like this approach.

Managing your dotfiles

I was looking for some easy way to manage my dotfiles. Dotfiles are just configuration files most systems use today. They are stored in your home directory $HOME, and are prefixed with a . to make them hidden. An example of dotfiles: .gitconfig, .vimrc, .npmrc, .yarnrc

I stumbled upon a great post on Hacker News about how to manage your dotfiles. I followed those steps and decided to write a bit about my process.

Continue reading

© 2019 Gaui.is

Theme by Anders NorenUp ↑