How I Created My dotfiles


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.

,

One response to “How I Created My dotfiles

  1. The Year 2019: As The Last Sun Sets - Junaid Qadir Avatar

    I started writing these year-end reviews starting last year. I really enjoyed writing it and got some great feedback from friends and family. Thank you, everyone. You can read it over here. Continuing the tradition, here’s my recap of 2019:
    Things That Didn’t Work
    Community Service
    I kick-started 2019 by moving to my hometown and starting a new job. The Job is doing pretty good. I had plenty of free time during weekends which I wanted to dedicate to my community, so I stared a free programming course at a local community center. I’m still not sure if it was the place, because the course was free or maybe it was me. The course was a total disaster.
    Machine Learning
    I challenged myself to get hands-on with Machine Learning. I even purchased learning material spent time to learn but turned out its way difficult than I expected. So that didn’t work as well.
    Health
    I have been getting severe migraines on and off, for the past few years now. This year was the worst for my health so far thanks to migraines. Once the migraine kicks in, it can last up to days, four days was the maximum streak I got this year. I can’t explain how unbearable and unbearably painful it is. trust me its one’s worst nightmare.
    I totally failed to manage my migraines this year.
    Writing
    In terms of writing, 2018 was a great year. I still get feedback from one of my most-read and well-received articles. This year, I managed to write only one article and that’s pretty bizarre for someone who claims to be a writer or a blogger. I’m truly ashamed that I didn’t write more in 2019.
    Things That Worked
    Freelancing
    I can say this year was a good year for freelancing for me because I managed to complete a couple of projects. I’m looking forward for more in 2020.
    Side Projects
    This year I open-sourced a Laravel package. I developed this project back in 2018 and kept it secret. I did use it in my side projects to help me with repetitive CRUD generation tasks though. More on that in the Open Source Contribution section.
    I’m still working on a couple of secret side projects some of them may be for wealth generation and some for FOSS.
    Open Source Contribution
    Laravel CRUD Scaffold is basically Laravel’s make commands on steroids. It’s a pretty opinionated package which generates models, controllers, views, form requests, migrations, and even factories by just passing in a model name.
    Please give it a try and if you like it do Star it to show your love. You can check it out here. On a side note, as of writing this, I’m working on to rename the project to a bit easy to remember and easy to type name and also writing tests for it to make it more reliable.
    This year I also managed to contribute to Laravel ecosystem. It was a meager one-liner pull request but regardless of the size of the contribution, it made me really happy and proud from inside.
    Self Improvement
    This year I tried to be a bit better of a human than I was in 2018. Next year I’ll try to be even better.
    Social Media Fasting
    This year I reduced my social media usage. Especially, I stopped using Facebook and Instagram. I shared way fewer statuses on WhatsApp than the previous year. But on the contrary, my Twitter, Youtube, Dev.to and StackOverflow usage increased. And I’m pretty happy with the improvement.

    I’m going to observe Social Media Fasting for a month to focus on things that matter more than social media. See you all in a month or may be never. #SocialMedia #SocialMediaFasting #SocialMediaFastingForAMonth— Junaid Qadir (@JunaidQadirB) August 24, 2019

    https://platform.twitter.com/widgets.jsAutomation
    Okay, the heading is misleading since it is about organizing and version-controlling my dotfiles. I had heard a lot of developers talking about dotfiles and how they benefit them. I did’t pay attention until I saw this tweet from Laracasts:

    A brand new series launches today on Laracasts! I’ve invited a number of guests to, one teacher per episode, teach you what you they know best. First up is @driesvints‘ review of managing dotfiles. https://t.co/tUEYOaa2Yl— Laracasts (@laracasts) October 30, 2019

    https://platform.twitter.com/widgets.jsEven though I created all my bash scripts from scratch on my own but this video definitely gave me the motivation I needed. I wrote about how I created my dotfiles in this article. I have a sense of relief after organizing my dotfiles files. Now the process of keeping them synced is automated and they are safely stored in a GitHub private repo. I commit any changes I make on a regular basis.
    The Journey Ahead
    For 2020, I’m keeping my expectations a bit low and I will try to improve upon a few things from 2019 plus I’ll focus on improving my Testing skills using TDD, as much as I possibly can.
    So, that will be all for my year-end review. Wish you a very Happy and a Prosperous New Year!

Leave a Reply

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

%d bloggers like this: