Skip to content

Instantly share code, notes, and snippets.

@gstro
Last active December 16, 2015 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gstro/fdec5def0de9b7c45cdd to your computer and use it in GitHub Desktop.
Save gstro/fdec5def0de9b7c45cdd to your computer and use it in GitHub Desktop.
##################
# Mostly from http://blog.taylormcgann.com/2012/06/13/customize-your-shell-command-prompt/
##################
##################
### MY ALIASES ###
##################
# git command autocompletion script (git installed from homebrew)
source /usr/local/etc/bash_completion.d/git-completion.bash
source /usr/local/etc/bash_completion.d/git-prompt.sh
# git commamands simplified
alias gst='git status'
alias gco='git checkout'
alias gci='git commit'
alias grb='git rebase'
alias gbr='git branch'
alias gad='git add -A'
alias gpl='git pull'
alias gpu='git push'
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'
# hibernation and sleep settings
alias hibernate='sudo pmset -a hibernatemode 25'
alias sleep='sudo pmset -a hibernatemode 0'
alias safesleep='sudo pmset -a hibernatemode 3'
alias smartsleep='sudo pmset -a hibernatemode 2'
# 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'
# proxy tunnel
#alias proxy='ssh -D XXXX -p XXXX USER@DOMAIN'
# ssh home
#alias sshome='ssh -p XXXX USER@DOMAIN'
# processes
#alias ps='ps -ax'
# refresh shell
alias reload='source ~/.bash_profile'
###############################
### ENVIRONMENTAL VARIABLES ###
###############################
# Add homebrew sbin to PATH variable
export PATH=$PATH:/usr/local/sbin
# Add personal bin to PATH variable
export PATH=$PATH:/Users/greg/bin # May be redundant; check ~/.bash_profile, /etc/profile, /etc/paths, /etc/bashrc
# Show dirty state in prompt when in Git repos
export GIT_PS1_SHOWDIRTYSTATE=1
# Change prompt
PS1_OLD=${PS1}
export PS1='\[\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