Stowing Your Dotfiles

Publish Date:  Last Update:
Tags:guide linux dotfiles
280 words, 2 minute(s) to read.

Linux differs from other operating systems in how most applications are configured - through files. Using text for configuration might seem as a step-back, however, GUI configurations were never a progression.

Having applications configured through text has a couple of advantages:

Your dotfiles in Git

In order to have portable dotfiles, you need a method of update & transport. For that, you can use Git.

To set up your dotfiles for the first time:

1
2
3
4
$ mkdir .dotfiles
$ cd .dotfiles
$ git init
$ git remote add origin <your-url>

Inside the .dotfiles directory, create your configuration files:

1
2
3
4
5
6
7
$ ll .dotfiles
total 20K
drwxr-xr-x 21 ayham ayham 4.0K Jan  9 09:40 .config
drwxr-xr-x  8 ayham ayham 4.0K Jan  9 16:27 .git
-rw-r--r--  1 ayham ayham  135 May 21  2022 .gitignore
drwxr-xr-x  4 ayham ayham 4.0K Jul 14  2021 .local
-rwx------  1 ayham ayham 2.0K Oct  3 15:23 .zprofile

Installing Your Dotfiles

To install your configurations on a new Linux install:

1
2
3
$ git clone <your-url>
$ cd .dotfiles/
$  stow --target=/home/<your-user> .

Now you would have your files linked in your home directory:

1
2
3
4
$ ls -al
...
lrwxrwxrwx   1 ayham ayham   19 Jul 14  2021 .zprofile -> .dotfiles/.zprofile
...

Enjoy!