<span class='p-name'>How I Created My dotfiles</span>
How I Created My dotfiles
07 Nov 2019 Leave a comment Bash, Composer, dotfiles, Laracasts, Laravel, Linux, Shell, Ubuntu

What Is A dotfile?

On *nix systems file/directory names starting with a period or a dot [.] symbol are considered user-specific configuration files and they are hidden by default. The most common examples of dotfiles are .profile, .bashrc for files and .config/ .font/ for directories. Since these hold user-specific configuration, they are found in home director of the user referred to as ~ (pronounced tilde).

Not Late Yet

It was always on the back of my mind. It lurked there, made me anxious from deep inside. Because some people won’t get it until it hits them. Disasters can happen and when they do happen, you can’t do anything except to have a backup plan and a backup; or regret for for life (Not really). Fortunately I haven’t met a disaster yet and I still didn’t bother to sit down and organize my dotfiles and configurations and store them to a safe place like GitHub.

Public Service Announcement

Just. Go. For. It. You don’t have to do it all at once. Just take small steps like create your dotfiles directory. Then move your dotfiles and initially symlink them manually just like I did. If you know how to write code then you’ll be fine with Bash. Keep Mr. Google (or whatever you into) handy all the time.

The Motivation

A few days ago Jeffrey Way started a new series on Laracasts(I’m one happy subscriber by the way) called Guest Spotlight. Interestingly the first episode of the series is about dotfiles. So I watched it. and I got motivated at the same time got anxious that how and from where I’m gonna start. Some time back I created a list of Linux applications that I regularly use. I pulled out that file and took a good look at it then opened my aliases file and I felt really overwhelmed and I closed everything.

Boy, I Got Pumped!

Fast-forward a few days and I decided to just do it. I created a .dotfiles directory in my home directory and started moving my .bashrc, .zshrc, .aliases, .gitconfig and manually symlinked them. I use Apache HTTP Server for my local development so I copied my sites-available director and moved it to Apache directory under ~/.dotfiles, along with my hosts file from /etc/hosts and and created symlinks for all of them manually. Then I called it a day feeling a bit better for whatever I accomplished..

It was just the beginning but unfortunately, on November 6th, I got sick and lost my whole day but I felt better and was on my feet by evening. So I sat and categorized sources of my software. Since I use Ubuntu, I can install software through various channels like apt, snap, flatpack or .deb files. So I createdapps.sh file and added sudo apt-get install [app-name] -y for all of my 14 softwares for the first iteration.

Created gnome.sh to restore my Gnome desktop settings from the backup file I created in the .dotfiled directory. This only runs docnf with the load flag like this:

dconf load / < dconf-settings.ini

Pretty simple. After that, I created composer.sh to install my global composer packages. At the moment I use 3 composer packages globally

  1. hirak/prestissimo This handy package lets me install composer packages in parallel.
  2. korri/composer-version Cli toot that increments composer.json file version number and commits to the git repo.
  3. laravel/installer Laravel installer.

Finally, I created the .shell file responsible for downloading and configuring zsh and symlinking the dotfileslike .zshrc .bashrc .gitconfig, and a couple of other files.

Then I needed a way to run all of these scripts, the main script. Like most people I chose to call my main script insatll.sh. When run, it displays my banner (because why not!) then it displays a warning and upon typing yes it will call all the script files one after another.’

I have yet to include a shell script for PHP and restore Sublime Text and PHPStorm configuration. As I said earlier I’ll do it gradually.

Show Me The Files

At the moment the repo is private on GitHub because it has a lot of personal stuff in there. In the future, I might fork a new repo and remove any personal stuff so that I can easily share it with the world.

Closing Thoughts

My concern was always that it’s complex and I have to learn a ton of things to fully automate my environment. But in reality, it was not that difficult. it barely took me a few hours spread across a couple of days. So the lesson here is, sometimes things seem so overwhelming that our fear just holds us back. Therefore, no need to do extensive planning just start doing it you’ll end up just fine.

Want to say something? Click here to leave a comment.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.