Last active
October 16, 2025 00:56
-
-
Save bbrown/b580ed4e31fd32cf74b9 to your computer and use it in GitHub Desktop.
My current bash settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################### | |
| ######## THERE ARE SECRETS IN THIS FILE | |
| ######## DO NOT COPY THIS OR DISTRIBUTE | |
| ######## IT PUBLICLY. BE CAREFUL. | |
| ############################################### | |
| alias restart="source ~/.bash_profile" | |
| alias updatedb='sudo /usr/libexec/locate.updatedb' | |
| alias ls='ls -lh' | |
| alias c='clear' | |
| alias cls='c;ls' | |
| alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | |
| alias localip="ipconfig getifaddr en0" | |
| alias b='brew' | |
| alias bc='b cleanup' | |
| alias bd='b doctor' | |
| alias bo='b outdated' | |
| alias bu='b update; brew link --overwrite php@8.1' | |
| alias bup='b upgrade' | |
| alias gb='git branch -avv' | |
| alias gcm='git commit --message' | |
| alias gd='git diff head' | |
| alias gds='git diff --staged' | |
| alias gf='git fetch --prune' | |
| alias cgf='gf;cgs' | |
| alias gl='git log --oneline --graph --decorate --branches' | |
| alias gp='git stash;git pull --rebase;git stash pop' | |
| alias gpm='git stash;git pull --rebase origin main;git stash pop' | |
| alias cgp='gp;cgs' | |
| alias cgpm='gpm;cgs' | |
| alias gr='git checkout --' | |
| alias gs='git status -sb' | |
| alias gsl='git stash list' | |
| alias gsm='git submodule update --remote --recursive' | |
| alias gsu='git submodule update' | |
| alias cgs='c;gs' | |
| alias push='git push;say "Push it real good." -v Samantha' | |
| alias standup='git standup -s' | |
| alias leaderboard='git shortlog -ns --no-merges' | |
| alias deploying='git --no-pager log --pretty="%s" $(git rev-list --tags="deploy*" --max-count=1)..HEAD' | |
| alias ndb='node --inspect-brk' | |
| alias tz='cat /usr/share/zoneinfo.default/zone.tab | grep ' | |
| alias d='docker' | |
| alias dc='docker-compose' | |
| # Workyard aliases | |
| alias a='php artisan' | |
| alias cmw='php artisan cmw -r main' | |
| alias ptp='php artisan test --parallel' | |
| alias ft='php artisan test --stop-on-failure' | |
| alias sshs='cd ~/.staging ; eb ssh ; cd -' | |
| alias sshp='cd ~/.production ; eb ssh ; cd -' | |
| alias refresh='composer install && php artisan migrate --env=testing && php artisan l5-swagger:generate && composer format' | |
| # via https://unix.stackexchange.com/a/20830/126265 | |
| # Key bindings, up/down arrow searches through history | |
| bind '"\e[A": history-search-backward' | |
| bind '"\e[B": history-search-forward' | |
| bind '"\eOA": history-search-backward' | |
| bind '"\eOB": history-search-forward' | |
| export EDITOR='subl -w' | |
| export GOPATH=$HOME/go | |
| export DOTNET_ROOT=$HOME/.dotnet | |
| export PATH=/usr/local/bin:/bin:/opt/homebrew:$HOME/.composer/vendor/bin:$HOME/bin:/usr/local/mysql/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/bin:/opt/homebrew:/Users/bbrown/bin:/Users/bbrown/.npm-packages/bin:/Users/bbrown/go/bin:/usr/bin:/usr/sbin:/sbin:/Applications/iTerm.app/Contents/Resources/utilities:/usr/local/share/dotnet:$DOTNET_ROOT/tools:$PATH | |
| export PS1="\W \$ " | |
| export HOMEBREW_PREFIX="/opt/homebrew"; | |
| export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; | |
| export HOMEBREW_REPOSITORY="/opt/homebrew"; | |
| #PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/bin:/opt/homebrew:/Users/bbrown/bin:/Users/bbrown/.npm-packages/bin:/Users/bbrown/go/bin:/usr/bin:/usr/sbin:/sbin:/Applications/iTerm.app/Contents/Resources/utilities"; export PATH; | |
| [ -z "${MANPATH-}" ] || export MANPATH=":${MANPATH#:}"; | |
| export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; | |
| # Access token for Homebrew to search Github | |
| # Descope entirely - https://gist.github.com/christopheranderton/8644743 | |
| export HOMEBREW_GITHUB_API_TOKEN="GITHUB_API_TOKEN" | |
| export HOMEBREW_AUTO_UPDATE_SECS=3600 | |
| export HISTSIZE=50000 | |
| # Erases any duplicate commands from history | |
| export HISTCONTROL=ignoreboth:erasedups | |
| # Disables history logging for jrnl | |
| export HISTIGNORE="$HISTIGNORE:jrnl *" | |
| export SENTRY_LOAD_DOTENV=0 | |
| export LINEAR_API_KEY="LINEAR_API_TOKEN" | |
| # Colorize man pages | |
| # From: http://boredzo.org/blog/archives/2016-08-15/colorized-man-pages-understood-and-customized | |
| man() | |
| { | |
| env \ | |
| LESS_TERMCAP_mb=$(printf "\e[1;31m") \ | |
| LESS_TERMCAP_md=$(printf "\e[1;31m") \ | |
| LESS_TERMCAP_me=$(printf "\e[0m") \ | |
| LESS_TERMCAP_se=$(printf "\e[0m") \ | |
| LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ | |
| LESS_TERMCAP_ue=$(printf "\e[0m") \ | |
| LESS_TERMCAP_us=$(printf "\e[1;32m") \ | |
| man "$@" | |
| } | |
| # https://muhammadraza.me/2023/shell-functions/ | |
| function csv { | |
| if [ -z "$1" ]; then echo "Usage: view_csv_pretty <file.csv>" | |
| else cat "$1" | column -s, -t | less -F -S -X -K | |
| fi | |
| } | |
| f() | |
| { | |
| open -a "Finder" "${1-.}"; | |
| } | |
| # process grep with optional kill | |
| # From: https://news.ycombinator.com/item?id=12366412 | |
| pgk () | |
| { | |
| [ -z "$*" ] && echo 'Usage: pgk <pattern>' && return 1; | |
| pgrep -fl $*; | |
| [ "$?" == "1" ] && echo 'No processes match' && return 1; | |
| echo 'Hit [Enter] to pkill, [Ctrl+C] to abort'; | |
| read && pkill -f $* | |
| } | |
| # truncate each line of the input to X characters ($1) | |
| shorten () | |
| { | |
| cat | sed -E "s/(.{${1-70}}).*(\.[^\.]+)?$/\1...\2/" | |
| } | |
| # Convert simplified wildcard pattern to regex and grep a file listing using | |
| # Silver Searcher (`brew install the_silver_searcher`) | |
| # http://brettterpstra.com/2018/11/07/shell-tricks-instant-wildcard-directory-search/ | |
| lsgrep () | |
| { | |
| NEEDLE="$(echo $@|sed -E 's/\.([a-z0-9]+)$/\\.\1/'|sed -E 's/\?/./'| sed -E 's/[ *]/.*?/g')"; | |
| ag --depth 3 -S -g "$NEEDLE" 2> /dev/null | |
| } | |
| pushover() | |
| { | |
| curl -s -F "token=PUSHOVER_APP_TOKEN" \ | |
| -F "user=PUSHOVER_USER_KEY" \ | |
| -F "title=terminal" \ | |
| -F "message=$1" https://api.pushover.net/1/messages.json > /dev/null 2>&1 | |
| } | |
| # Credit: https://news.ycombinator.com/item?id=26304832 | |
| sudo() { | |
| unset -f sudo | |
| if [[ "$(uname)" == 'Darwin' ]] && ! grep 'pam_tid.so' /etc/pam.d/sudo --silent; then | |
| sudo sed -i -e '1s;^;auth sufficient pam_tid.so\n;' /etc/pam.d/sudo | |
| fi | |
| sudo "$@" | |
| } | |
| function tabname | |
| { | |
| printf "\e]1;$1\a" | |
| } | |
| function winname | |
| { | |
| printf "\e]2;$1\a" | |
| } | |
| test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash | |
| complete -C /Users/bbrown/go/bin/vault vault | |
| if [ -f "/opt/homebrew/opt/bash-git-prompt/share/gitprompt.sh" ]; then | |
| __GIT_PROMPT_DIR="/opt/homebrew/opt/bash-git-prompt/share" | |
| source "/opt/homebrew/opt/bash-git-prompt/share/gitprompt.sh" | |
| fi | |
| export PYENV_ROOT="$HOME/.pyenv" | |
| [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
| [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
| export SENTRY_LOAD_DOTENV=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment