“And what, pray tell, is a dotFiles Project?”
This is just a fancy name, a title, if you will, to describe how I set up my terminal for development, particularly useful after a fresh system reinstall. Simply put, these files dictate and orchestrate any startup actions that I wish to take when I start my terminal. Many devs and coders have their own versions of their dotFiles, and this blog post is no different. Please feel free to research the topic, and mix and match to suit your needs.
This is a minimal post, intended mostly as a reminder to myself on rebuilding my environment in the event of a system refresh. There are sample files that can be viewed on Bitbucket, and should serve as examples of how I’m using my dotFiles. A later post will detail my strategy for setting up a new environment, which rely on this dotFile setup.
Disclaimer: Every system is different, this by no means is guaranteed to work for everyone in every situation. As far as I know, this should apply to Unix-based systems (Mac OS X and Ubuntu, I’m looking at you!). The only thing I can say with certainty is that this will not work on a Windows system.
For reference, the name of the dot file is echoed at the end of every file; this is a self-reminder as to what runs when:
Below are brief descriptions of each dotFile and what it does:
This script is intended to house operations that you’d typically like to start only once, at the start of a new terminal session. You can also add additional tasks here that are supportive of a ‘refresh’ of sorts; re-sourcing other dot files to add additional behaviour/characteristics without shutting down/restarting your current terminal session.
One example of operations that can/should be done in here are alterations to your prompt via $PS1 variable. Change the prompt at will, and reload by executing:
P.S. – ‘refresh’ is an alias that I wrote to do above task:
# Refresh shell
alias refresh=’source ~/.bashrc’
This script is intended to house user-defined aliases, and nothing else! This scripts can be rerun directly, or via the ‘refresh’ alias defined therein. For example, you can add new aliases and activate them by executing the following:
No need to start a new terminal session!
This script is intended to launch only when a new terminal is open. Currently, it’s only purpose is to launch the .profile script.
Some programs installed via Homebrew (and possibly others) install to .profile instead of .bash_profile. However, (if I remember right), a new terminal session will launch a .bash_profile script first. In this case, this script will launch the .profile script. This helps me avoid having to cut/paste code placed in .profile to .bash_profile.
This script is intended to run only once, at the start of a new terminal session. You would not typically want to run this more than once per session; for that functionality, add to the .bashrc file instead!
This script houses everything you would need to do to set up a terminal environment; the contents of this script are not intended to be run more than once in a terminal session. For example, executing:
/usr/local/bin to be added to the $PATH variable everytime it is executed. This particular example will probably not break anything, but will make for an unusually long and ugly $PATH environmental variable.
In the future, a few more dot files may be included in this repo as needed. I should not go too crazy here, so that I can keep track of the different dotfiles needed to edit for a particular task. See below for more vague details!
This script will house custom functions that will be needed by the terminal for various functions.
This one will house path setup, to remove them from .profile and make it leaner.
Any suggestions for additional ones? Comment below!