This is a central repo for my dotfiles. It's designed to work on macOS Mojave and newer and on linux supercomputing clusters. It's a work in progress, use at your own risk.
- bash >= 5.x
- nano >= 4.6
- git >= 2.24
- ack >= 3.x
- GNU coreutils >= 8.31
- GNU
time
bash_profile.shjust sources~/.bashrcwhich is symlinked to 'bashrc.sh'bashrc.shcontains all the sourcing statementsbash_aliases.shcontains all the global aliasesbash_exports.shcontains all global variables and other export commandsbash_functions.shcontains all bash functions<repo-root>/bincontains all global scripts- each host needs a directory with the hostname as the directory name and then
must contain the local
bash_aliases.sh,bash_exports.sh, andbash_functions.shfiles and all the local scripts in<repo-root>/HOSTNAME/bin- For long or unwieldy hostnames a remapping can be done in
bashrc.sh. See the example for the h2p cluster
- For long or unwieldy hostnames a remapping can be done in
- Fork this repo and change its name to "dotfiles"
- Make sure there is nothing in your original dotfiles that you want to keep.
They will be backed up to
~/.old-dotfiles-backupbut better safe than sorry - Check that ack, git, bash, and nano are all installed and of the appropriate
version
- If you are on macOS make sure to install GNU coreutils and GNU's
implementation of
timethen run the following commands and make sure to them to your hostsbashrc_exports.shfile before runningsetup.sh- PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
- MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
- If you are on macOS make sure to install GNU coreutils and GNU's
implementation of
- Clone this repo, it must be in the home directory. If you want to put it elsewhere you must change the setup script, the bashrc.sh file, and maybe others. I strongly recommend putting it on your home directory because every machine you use will have a home directory but might not have any additional directory structure.
- Create a directory for the new machine that is named like
<repo-root>/HOSTNAME. If the hostname is complex or there are multiple login nodes then you can remap them to a more human readable name inbashrc.sh; see the example there for the h2p cluster. You can find a working example for the H2P cluster at Pitt in the crc_h2p directory and you can make your own host directory by copying the host directory template in theTemplatesdirectory - Update
gitconfigwith your info and preferences. Any lines that have an equals sign with nothing on the right side of it either need to be edited with your information, commented out, or deleted. - Run
setup.shin<repo-root>/bin. This will add soft links tobash_profile.sh,bashrc.sh,nanorc,.pythonrc,.inputrc, andgitconfigand will backup the old versions of those files to~/.old-dotfiles-backup - If you want to setup other dotfiles (
.vimrcfor example) then edit the list of linked dotfiles insetup.shaccordingly - (optional) Install iTerm2 Shell Integration by copying appropriate files from a machine that has up to date versions of them or by following iTerm2's installation instructions
- Setting up git
- When setting up ssh you have to use the
~/.ssh/configfile to tell ssh which key is for GitHub and which is for other things
- When setting up ssh you have to use the
- Setting up GPG
- If you want to set up commit signing see the instructions in
<repo-root>/How-To-Guides/GPG setup.md
- If you want to set up commit signing see the instructions in
Here you will find a list of various aliases, functions, scripts, etc that are in this repo along with brief usage instructions (more detailed documentation can be found in the comments of a specific tool). Most of the tools are minimal as this repo is intended to be skeleton for your dotfiles rather than a list of my dotfiles.
- Always lists directory contents when you cd into a directory
- When starting a new shell it checks if your dotfiles are up to date. Note that
this adds significantly to the startup time. See the section on the
Repo-check-updates.shscript for details and how to disable it if you want - Syntax coloring files for GNU Nano
- Bash should be case insensitive when autocompleting. This doesn't always work
- A
pythonrc.pyfile that automatically imports a bunch of common libraries
cp,mv,rm,ls,rsync,tree,du, andscpall of these common commands have been aliased to include data protection, verbosity, or just to increase general usefulnessldirlist all direcotrieslashows hidden files as wellackaliases theacktool to ignore some directories (.git etc), ignore case, and ignore regexrmtmoves files to~/.Trash. A safer form of deleting..=cd ../...=cd ../../.Xgo back X directory levels where X = 3 to 6 inclusivedotfilescd directly to your dotfiles directoryrootcd to the root of the current git repotimeis dynamically aliased to the GNU implementation depending on OScppDebug,cppPerf,gfort_debug, andgfort_perfvarious sets of compiler flags for C++ and Fortran to compile with debugging or performance oriented flags
remakerunsmake cleanthenmake -j. Pipes the result tocompile.logand outputs how long the compile took using GNU Timefind-and-replacefinds one string in all the directory files and replaces it with another
- This is where you should be setting paths, environment variables, etc
- Sets the CLI prompt to be
user@host:PWD$
Note that scripts from any interpreted language (including python) can be run if
they are in the <repo-root>/bin or <repo-root>/hostname/bin directories.
Just make sure that the first line of the script is the appropriate shebang;
#!/usr/bin/env bash for bash and #!/usr/bin/env python3 for python.
Repo-check-updates.shchecks if the current github repos status compared to the upstream repo. It will tell you to pull or push or if the repo is up to date or has diverged. This script is mostly used indirectly through other scripts. It is run every time you start a new shell to check if the dotfiles repo is up to date. This add about 0.5 seconds to the startup time and can be disabled by commenting out the appropriate line inbashrc.sh-gitall.sh *command*run the same git command on a bunch of repos. Runninggitall.sh checkwill runRepo-check-updates.shon every git repo. The list of repos used is given in thegitall.shscriptmacos-update-script.shupdates homebrew, homebrew packages, and your conda environment. Make sure to edit it to include which homebrew packages you want updated.setup.shused for initial setup of this dotfiles system
- Make sure to set all the blank fields
- A git commit template is stored at
<repo-root>/git-message-template.txt. Feel free to edit it to your own taste. - Includes: this section is used for including GPG commit signing. See the
instructions in
<repo-root>/How-To-Guides/GPG setup.mdfor details
stickmy preferred version ofgit log, limited to the last 30 commitslongStickmy preferred version ofgit log, unlimited number of commitsstatshort forstatuscomshort forcommitcashort forcommit -afix-commitstart editing a started commit messagecheckrunsRepo-check-updates.shon the current git reponewshows all commits created by the last commandeditopens all unstaged files for editing in VS Code. Easily edited to open unstaged files in any GUI editor that supports CLI invocation. You will have the change the path in this command to the path of your text editor of choicehubif you're on macOS it automatically opens the GitHub page for this repo in your default browser. On other operating systems it prints out the URL for the GitHub page
This directory contains some basic guides on setting up GPG signing of git commits and bash performance profiling.
A collection of templates for common tasks. Most have self explanatory names.
Host-directory-templateA template directory for a machines local dotfilesgit repo templateA template for git reposFortran module/program template.f90Templates for Fortran codepython template.pyA template for python scriptsslurm-template.slurmA template for a slurm submission scriptPerfTimer.hA C++ header only timing class for C++ codecppArgParserA C++ header only class for parsing input arguments