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.
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:
setupis used to reproduce my computer's configuration on other computers with things like packages, apps, and dotfiles.
upgradeis used to upgrade what's installed on my computer with things like packages, apps, and the operating system.
endis used to clean up my computer's state with things like deleting artifacts, stopping running processes, and making sure all my git repos are synced.
Dotfiles are used to configure packages and apps. They are files that have a filename that is usually prefixed with a dot (period) like
.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
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
#!/bin/sh echo "Symlinking dotfiles" cd ./dotfiles shopt -s dotglob for root_file in *; do ln -s "$(pwd)/$root_file" "$HOME/$root_file" done 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.