Skip to content

Instantly share code, notes, and snippets.

@micahlmartin
Created August 12, 2012 22:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micahlmartin/3335079 to your computer and use it in GitHub Desktop.
Save micahlmartin/3335079 to your computer and use it in GitHub Desktop.
Micah's Bash profile for mac
export PATH+=/usr/local/bin
#list all and colorize
alias ls='ls -Ga'
#fix for gitk
alias gitk='gitk 2>/dev/null'
#list files only
alias lf='ls -l | grep -v ^d'
#list directories only
alias ld='ls -l | grep ^d'
#edit hosts file
alias hosts='sudo sublime /private/etc/hosts'
#flush dns
alias flushdns='dscacheutil -flushcache && echo "cache flushed"'
#reload bash profile
alias reloadbash='source ~/.bash_profile'
#edit bash profile
alias editbash='sublime ~/.bash_profile'
#add the current git branch to your promp
#output: username currentdirectory (gitbranch) $
if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then
. /usr/local/etc/bash_completion.d/git-completion.bash;
PS1='\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\]\[\e[1;37m\]\e[0;33m$(__git_ps1)\e[0m\n'
fi
@TomDeMille
Copy link

TOM's: Mostly from Jared's

alias sublime='open -a Sublime\ Text\ 2'

alias st='git status'
alias commit='git commit -a -m'
alias pullo='git pull origin'
alias pusho='git push origin'

alias openhosts='sudo nano /private/etc/hosts'
alias flush='dscacheutil -flushcache && echo "cache flushed"'

alias showalltrue='defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder'
alias showallfalse='defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder'

export PAGER="col -b | open -a /Applications/Google\ Chrome.app -f"

if [ -f brew --prefix/etc/bash_completion ]; then
. brew --prefix/etc/bash_completion
fi

PS1="\W$(__git_ps1) $ "

@TomDeMille
Copy link

I actually don't use the git alias stuff becuase I have more complete git alias in my gitconfig.. Micah what is the PS1 regex stuff all about?

@micahlmartin
Copy link
Author

the PS1 variable sets the prompt text and colorizes it. Basically this is what it outputs:

username currentdirectory (gitbranch) $

It's pretty sweet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment