Bash profile (created for mac terminal) file that has color syntax for prompt and directories. Also includes the currently active git branch.
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\]\$ "
export CLICOLOR=1
export LSCOLORS=DxFxBxDxCxegedabagacad
alias ls='ls -GFh'
alias ll='ls -la'
alias hg='history | grep '
alias ssha='grep -i -e ^host ~/.ssh/config | cut -d" " -f 2'
alias mynetcon="sudo lsof -n -P -i +c 15"
alias grepn='grep -n --exclude-dir=node_modules -r '
alias greprn='grep -n --exclude-dir=node_modules --exclude-dir=android --exclude-dir=ios --exclude-dir=__tests__ -r '
alias sshhosts='grep "Host " ~/.ssh/config | cut -d" " -f2'
# git graphs can use an (optional) last parameter of the number of commits to display (ex usage gitgraph -10)
alias gitgraph="git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
alias gitgraph2lines="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
alias finder_show_hidden='finderShowHidden'
alias hidden_hide_hidden='finderHideHidden'
function finderShowHidden() {
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
}
function finderHideHidden() {
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
}
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Android\ Studio.app/sdk/platform-tools/:/Applications/Android\ Studio.app/sdk/tools/
#Returns the current git branch in the terminal.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}