Skip to content

Instantly share code, notes, and snippets.

@sleicester
Created January 25, 2014 18:23
Show Gist options
  • Save sleicester/08a2ce9415f2e909402f to your computer and use it in GitHub Desktop.
Save sleicester/08a2ce9415f2e909402f to your computer and use it in GitHub Desktop.
.profile with some neat aliases and coloured prompt, particularly useful is the display of current git branch
# found this here:
# http://blog.taylormcgann.com/tag/prompt-color/
# git commamands simplified
alias gst='git status'
alias gco='git checkout'
alias gci='git commit'
alias grb='git rebase'
alias gbr='git branch'
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias glg2='git log --date-order --all --graph --name-status --format="%C(green)%H%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
# ls alias for color-mode
alias ls='ls -lhaG'
# lock computer
alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
# up 'n' folders
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# simple ip
alias ip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2'
# more details
alias ip1="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# external ip
alias ip2="curl -s http://www.showmyip.com/simple/ | awk '{print $1}'"
# grep with color
alias grep='grep --color=auto'
# refresh shell
alias reload='source ~/.profile'
# Change prompt
PS1_OLD=${PS1}
export PS1='\[\033[1;34m\]\!\[\033[0m\] \[\033[1;35m\]\u\[\033[0m\]:\[\033[1;35m\]\W\[\033[0m\] \[\033[1;92m\]$(__git_ps1 "(%s)")\[\033[0m\]$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment