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.


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

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

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.