Automating computer configuration with scripts
Mon Nov 18, 2019


Scripts are a way to automate tasks on your computer. I keep my scripts backed up in a Git repo so they can be used on any machine I am on.

View my scripts

The beauty of scripts like this is that they let you reproduce your machine's state on another computer. For example, I use the following scripts:


Dotfiles are used to configure packages and apps. They are files that have a filename that is usually prefixed with a dot (period) like .gitconfig and .vimrc. This means they are usually hidden by default on most operating systems. Most of them live in your home directory (although projects can have local dotfiles that override global settings such as .gitignore).

You can see your global dotfiles by listing the hidden files in your home directory:

cd ~
ls -a

Some tools generate dotfiles automatically. Others you can add and manage yourself.

Most tools that use dotfiles require their dotfiles to exist in your home directory. So you can create a script that either symlinks (symbolic links) them to your home directory, or a script that generates the output. For example, this script would symlink any files in the dotfiles directory:


echo "Symlinking dotfiles"

cd ./dotfiles

shopt -s dotglob

for root_file in *; do
	ln -s "$(pwd)/$root_file" "$HOME/$root_file"

cd ..


Scripts are a great way to automate your computer configuration. I'd recommend organizing yours in a Git repo so that you can keep track of and reproduce your settings on any other machine.

Posts · Newsletter · Code · Videos · Resume · Home