Skip to content

Instantly share code, notes, and snippets.

@SethMMorton
Created June 9, 2012 16:03
Show Gist options
  • Save SethMMorton/2901607 to your computer and use it in GitHub Desktop.
Save SethMMorton/2901607 to your computer and use it in GitHub Desktop.
General Mac OS X .profile
#!/bin/bash
# Global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Change the window title of X terminals (similar to Fedora's)
export PS1="[\u@\h \W]\\$ "
export PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
# Don't print duplicates when I hit the up button
export HISTCONTROL=ignoredups
#------
# Paths
#------
# Redefine the default PATH with preference to /usr/local/bin for use with Homebrew
export PATH=/usr/local/bin:/usr/local/share/python:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:$HOME/bin:/usr/local/sbin
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$HOME/Documents/Programming
#------------------------------------
# User specific aliases and functions
#------------------------------------
# Tab complete brew commands
source $(brew --prefix)/Library/Contributions/brew_bash_completion.sh
# Make a patch file between two source trees
alias make_patch="diff -uNr"
# Clear the screen of your clutter
alias c="clear"
alias cl="clear;ls;pwd"
# Make grep use color by default, and make a shortcut to using perl regex
alias grep="grep --color"
alias grepp="grep -P --color"
# Shortcuts for various ls options. All of these add colors, ignore files
# ending with '~', and add '/' to the end of folders. Shortcuts ending
# with 'a' show hidden files as well, except the redundant '.' and '..'.
alias ls="ls -pBG"
alias la="ls -pAG"
alias ll="ls -phlG" # long-form list
alias lla="ls -phlAG"
alias lz="ls -pshSG" # sort by file size
alias lza="ls -pshSAG"
alias lt="ls -pghotrG" # long-form, sort by modification date
alias lta="ls -pghotrAG"
alias lx="ls -pghoXG" # sort by file extention
alias lxa="ls -pghoXAG"
alias lr="ls -ARpshG" # recursive list (watch out! It will fill your screen!)
# Make some of the file manipulation programs verbose
alias mv="mv -v"
alias rm="rm -v"
alias cp="cp -v"
# Prints disk usage in human readable form
alias d="du -sh"
# Forces an update of the locate database
alias updatedb="sudo /usr/libexec/locate.updatedb"
# Function to automatically extract a compressed file
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar -xvjf $1 ;;
*.tar.gz) tar -xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar -x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar -xvf $1 ;;
*.tbz2) tar -xvjf $1 ;;
*.tgz) tar -xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z -x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment