Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Bash Config

I wanted to setup my runtime configuration in a way that was reasonably portable and consistent across a variety of operating systems, bash versions, and terminal emulators, while allowing for additional configurations and overrides specific to each environment.


  • Ensure docs are up-to-date
  • Better variable scoping for configurations


Clone repo as ~/.bash_config and run install script:

git clone ~/.bash_config


To pull changes from the remote repository and initialize any new submodules, run:


If you're using my vim runtime repo (or a fork of it), you can run the following script to update it as well:



This repo includes a few useful submodules. These are stored in the modules/ directory.

Included Modules

  • base16-shell is included as a submodule for quickly setting the terminal colorscheme.
  • iterm2-tab-color adds functions for setting the tab color in iTerm2.
  • used to display Chicago skyline or flag on startup

Enabling, Disabling, and Configuring Modules

Enabled submodules can be configured in modules/ To disable a submodule, set the corresponding variable to 0. E.g. if you wanted to disable iterm2-tab-color:



Some additional configurations can be found in modules/ See comments for more information.

PS1 Prompt

Configurations for the PS1 prompt can be found in globalrc.d/prompt/ This repo uses bash-powerline by default.

If POWERLINE_ENABLE is set to 1, globalrc.d/prompt/ will be sourced to set the PS1 prompt to a modified version of bash-powerline (this is the default configuration).

If POWERLINE_ENABLE is set to 0, globalrc.d/prompt/ will be sourced to set the PS1 prompt to a vanilla PS1.

See globalrc.d/prompt/ for additional options.


The following aliases are declared in globalrc.d/ Some of these will only be included depending on OS and what command line utilities are installed.

ls aliases:

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

Color prompt aliases:

# grep
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# If colordiff command exists, alias diff
alias diff=colordiff

# If tree command exists, alias tree -C
alias tree="tree -CF"

MacOS aliases:

# Copy previous command to clipboard
alias copy-last-cmd="fc -ln -1 | awk '{\$1=\$1}1' | pbcopy"
# MacOS doesn't have --color option (color prompt only)
alias ls='ls --color=auto'

Misc aliases:

alias md='mkdir'
alias cls='clear'


The following convenience functions are included from globalrc.d/

todo - Recursively searches files for TODO or FIXME comments using grep and prints them out. Optionally takes a positional argument for the directory to search. If no arguments are specified, it will search the current directory.

todo-less - Like todo but pipes output into less to keep terminal history less cluttered.

cdl (alias: c) - Shorthand function that changes into a directory and lists its contents. Equivalent to:

cd <directory>

mkcd - Shorthand function that creates a directory and changes into it. Equivalent to:

mkdir <directory>
cd <directory>

le - If used on a file, will run less <file>. If used on a directory, will run ls <directory>.

Directory Structure

  • - Backs up the existing ~/.bashrc (if one exists) and creates a one-line .bashrc that sources ~/.bash_config/
  • - Pulls updates to main repo and submodules
  • - Sources globalrc.d/ and localrc.d/, then globalrc.d/ and localrc.d/
  • globalrc.d/ - Shared runtime configuration files
    • - Sources all bash configuration files in directory
    • - Bash runtime configurations
    • inputrc - Input configurations
    • - Declarations of bash functions
    • - Sourced after all other scripts are sourced
    • prompt/ - Configurations for PS1 prompt
      • - Configuration variables for PS1/powerline prompts
      • - Sources and one of the following scripts
      • - If POWERLINE_ENABLE is set to 1, this file will be sourced to set the PS1 prompt to a modified version of powerline
      • - If POWERLINE_ENABLE is set to 0, this file will be sourced to set the PS1 prompt to a vanilla PS1
  • localrc.d/ - Additional configurations specific to the machine. These are ignored by git.
    • bin/ - Local directory added to PATH, add any scripts you want accessible here
    • - Looks for any of the following files in localrc.d/ and sources them if they exist:
      • inputrc
    • - Sourced after all other scripts and globalrc.d/ are sourced
  • modules/ - git submodules
    • - Configurations for enabled/disabled submodules
    • - Sources and all enabled modules
    • base16-shell
    • iterm2-tab-color


Personal .bashrc repository





No releases published


No packages published