Skip to content

Instantly share code, notes, and snippets.

@itruls
Last active January 18, 2019 13:31
Show Gist options
  • Save itruls/b5747a44ef98f052b30f818842ecc4ab to your computer and use it in GitHub Desktop.
Save itruls/b5747a44ef98f052b30f818842ecc4ab to your computer and use it in GitHub Desktop.
Common aliases (include in .bash_profile on OS X)
# Include in .bash_profile or similar
if [[ $platform == 'linux' ]]; then
alias ll='ls -alh --color=auto'
alias ls='ls --color=auto'
elif [[ $platform == 'darwin' ]]; then
alias ll='ls -alGh'
alias ls='ls -Gh'
fi
# ANSI color codes
RS="\[\033[0m\]" # reset
HC="\[\033[1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGRN="\[\033[32m\]" # foreground green
FYEL="\[\033[33m\]" # foreground yellow
FBLE="\[\033[34m\]" # foreground blue
FMAG="\[\033[35m\]" # foreground magenta
FCYN="\[\033[36m\]" # foreground cyan
FWHT="\[\033[37m\]" # foreground white
BBLK="\[\033[40m\]" # background black
BRED="\[\033[41m\]" # background red
BGRN="\[\033[42m\]" # background green
BYEL="\[\033[43m\]" # background yellow
BBLE="\[\033[44m\]" # background blue
BMAG="\[\033[45m\]" # background magenta
BCYN="\[\033[46m\]" # background cyan
BWHT="\[\033[47m\]" # background white
echo "Make 'df' and 'du' show human friendly numbers and colors"
alias df='df -h'
alias du='du -h -d 2'
echo "Adding Homebrew alias: brewup"
alias brewup='brew update; brew upgrade; brew cleanup; brew doctor'
echo "Adding conda alias: condaup"
alias condaup='conda update --prefix $HOME/anaconda anaconda;conda update --all; conda clean --all'
echo "Adding git tab completion and prompt..."
BREW_PREFIX=$(brew --prefix)
if [ -f $BREW_PREFIX/etc/bash_completion ]; then
source $BREW_PREFIX/etc/bash_completion.d/git-completion.bash
source $BREW_PREFIX/etc/bash_completion.d/git-prompt.sh
fi
GIT_PS1_SHOWDIRTYSTATE=true
echo "Improving terminal prompt ..."
#export PS1="$FCYN\u$RS@$FGRN\h:$FYEL$HC\w$RS\$ "
export PS1="$FCYN\u$RS@$FGRN\h:$FYEL$HC\w\$(__git_ps1) $RS\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment