Last active
December 15, 2015 16:39
-
-
Save 4lun/5291221 to your computer and use it in GitHub Desktop.
OS X .bash_profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------- | |
# Aiases & Functions | |
# ------------------------- | |
# locations | |
alias desktop="cd ~/Desktop/" | |
alias dev="cd ~/Development/" | |
alias ..="cd ../" | |
# hosts related | |
alias apache="sudo apachectl" | |
alias vhosts="subl /private/etc/apache2/extra/httpd-vhosts.conf" | |
alias hosts="subl /private/etc/hosts" | |
# Load in the git branch prompt script. | |
source ~/.git-prompt.sh | |
# ------------------------- | |
# Set Editors | |
# ------------------------- | |
# general | |
export EDITOR='subl -w' | |
# svn | |
export SVN_MERGE='subl -w' | |
export SVN_EDITOR='subl -w' | |
# ------------------------- | |
# Add To PATH | |
# ------------------------- | |
# mysql | |
export PATH=$PATH:/usr/local/mysql/bin | |
# android-sdk | |
export PATH=$PATH:~/Development/tools/android-sdk/tools:~/Development/tools/android-sdk/platform-tools | |
# local bin | |
export PATH=$PATH:~/.bin | |
# ------------------------- | |
# Misc | |
# ------------------------- | |
# rvm | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
# z | |
. /usr/local/etc/profile.d/z.sh | |
# colour | |
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then | |
export PS1="\[\e[1;35;1m\]\u\[\e[0m\]\[\e[35m\]@\h\[\e[35;1m\]\w\[\e[1;37m\]\$(__git_ps1 \"[%s] \")\$ \[\e[0m\]" | |
else | |
export PS1="\[\e[36;1m\]\u\[\e[0m\]\[\e[36m\]@\h\[\e[36;1m\]\w\[\e[1;37m\]\n\$(__git_ps1 \"[%s] \")\$ \[\e[0m\]" | |
fi | |
# For reference, white on red, good for use on root user | |
# export PS1="\[\e[1;41m\]\u\[\e[0m\]\[\e[0;41m\]@\h\[\e[0;41m\]\w \[\e[1;37m\]\$ \[\e[0m\] " | |
# Make and cd into directory - Source: http://alias.sh/make-and-cd-directory | |
function mcd() { | |
mkdir -p "$1" && cd "$1"; | |
} | |
# Show which commands you use the most - Source: http://alias.sh/show-which-commands-you-use-most | |
alias freq='cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30' | |
# Remove ".svn" folders from working copy (recursive) - Source: http://alias.sh/remove-svn-folders-workingcopy-recursive | |
alias rm_svn="find . -type d -name .svn -exec rm -rf {} \;" | |
# Reload DNS on OSX - Source: http://alias.sh/reload-dns-osx | |
alias flushdns="dscacheutil -flushcache" | |
# cd and then ls - Source: http://alias.sh/cd-and-then-ls | |
function cd () { | |
builtin cd "$@" && ls; | |
} | |
# OS X keeps a log of all downloaded files, commands for listing and removing records | |
# http://news.ycombinator.com/item?id=5080350 & http://www.macgasm.net/2013/01/18/good-morning-your-mac-keeps-a-log-of-all-your-downloads/ | |
alias ls_downloads="sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'" | |
alias rm_downloads="sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'vacuum'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment