Skip to content

Instantly share code, notes, and snippets.

@anildigital
Created January 8, 2009 05:58
Show Gist options
  • Save anildigital/44602 to your computer and use it in GitHub Desktop.
Save anildigital/44602 to your computer and use it in GitHub Desktop.
##
# command aliases
##
alias die="killall"
alias ls="ls -G" # default settings for list (colors)
alias l="ls -GFh"
alias ll="ls -lFGh"
alias la="ls -laFGh"
alias dir="ls -asGh" # setup dir command just in case ;)
alias lf="echo '`ls -1 | wc -l` files'; disall" # number of files/directories in CWD, plus the total of every file (recursed)
alias du="du -hsk" # my defaults for du; (OSX)
alias dis="du -sk ./" # summarized and human-readable size of CWD including subdirectorie's
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
alias makejobs='grep [a-z]: Makefile' # sloppy but lists jobs in a make file
# alias cvs='/usr/local/bin/cvs' # use my compiled newer version of cvs
alias cvsnews="cvs diff --brief 2>/dev/null | grep 'Index' | cut -d : -f 2 | cut -d ' ' -f 2" # locally modified files in a cvs project dir
alias cvsconf="cvs -n up 2>/dev/null | grep C" # conflicts before updating a source tree
alias cvsknow="cvs -qn up 2>/dev/null | grep '?'" # files that cvs does not know about
alias cvsdown="cvs -qn up 2>/dev/null | grep 'U'" # files that can be updated from the repo
alias cvsdiff="cvs diff ./ | mate" # colored diff of current dir courtasy of vim
alias svndiff="svn diff | mate" # colorized svn diff within vim
alias svnnews="svn status -u | grep /(A|M)/" # modified files that can be committed with svn
alias svnknow="svn status -u | grep A | grep -v CVS" # svn doesn't know about, excluding CVS
alias svnmiss="svn status -u | grep [\?\!]" # svn files that need adding or removing
alias svninfo="svn status | awk '{print \$2}' | xargs svn info | less" # more detailed svn information
alias gitk="gitk --all $1 2>/dev/null"
alias gitb="git branch -a -v"
alias gitl="git-log --stat"
alias gitd='git log|grep commit|cut -d " " -f2|head -n 2|xargs -n 2 git diff -R'
# archives the last tree-ish
alias gita="git-archive --format=zip `git-reflog | grep 'HEAD@{0}' | cut -d ' ' -f1 | sed 's/[.]*//g'` > archive.zip"
alias spot="mdfind -onlyin ./ $1" # command-line search using spotlight (needs work)
alias rmdsstores="find ./ -type f | grep .DS_Store | xargs rm" # rm .DS_Store files recursively
##
# helpful ruby/rails aliases
##
alias resetrails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -HUP $1'
alias dierails='ps -a|grep "/usr/local/bin/ruby script/server"|grep -v "grep /usr"|cut -d " " -f1|xargs -n 1 kill -KILL $1'
alias rb="/usr/local/bin/ruby"
alias rbe="/usr/local/rubyee/bin/ruby"
alias fl="find . -name \*.rb | xargs flog"
alias tt="RAILS_ENV='test' autotest"
alias sa="rb script/about"
alias ss="rb script/server"
alias sc="rb script/console"
alias sg="rb script/generate"
alias sp="rb script/plugin"
alias sr="rb script/runner"
alias sd="rb script/destroy"
alias srs="rb script/spec -c spec --format specdoc"
alias srf="rb script/spec -c --format specdoc $1"
alias ett="mate app config db lib test public"
alias stt="mate spec stories test"
alias cover="rb script/spec -c spec --format html:./current_coverage.html --diff"
alias ssm='script/spec spec/models/$1 --format specdoc -c'
alias ssc='script/spec spec/controllers/$1 --format specdoc -c'
alias ssv='script/spec spec/views/$1 --format specdoc -c'
# ugh... but it works!
alias thins='ps ux | grep "thin server" | grep -v "grep" | cut -d " " -f 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28'
##
# ruby gem command aliases
##
alias gsl="gem search $1 -l"
alias gsr="gem search $1 -r"
alias gis="sudo gem install $1"
alias gun="sudo gem uninstall $1"
alias gup="sudo gem update $1"
alias gh="gem help commands"
alias gll="gem search -l | sed 's/(.*)\(.*\)/ /' | sed '/./!d' | sed '/^.*LOCAL.*$/d'"
alias egsl="/usr/local/rubyee/bin/ruby /usr/local/rubyee/bin/gem search $1 -l"
alias egis="sudo /usr/local/rubyee/bin/ruby /usr/local/rubyee/bin/gem install $1"
alias egun="sudo /usr/local/rubyee/bin/ruby /usr/local/rubyee/bin/gem uninstall $1"
alias egup="sudo /usr/local/rubyee/bin/ruby update $1"
##
# helpful merb aliases
##
alias mtt="mate app config merb public spec"
alias mg="merb-gen "
alias mc="bin/merb -i"
alias mm="bin/merb -a thin --debugger"
alias dmdb="rake db:automigrate"
##
# growl notification of ip address
##
alias myip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2 | growlnotify'
##
# current connections
##
alias conns='sudo lsof -i'
alias pg_start='sudo -u postgres /Library/PostgreSQL/8.3/bin/pg_ctl -D /Library/PostgreSQL/8.3/data start'
alias pg_stop='sudo -u postgres /Library/PostgreSQL/8.3/bin/pg_ctl -D /Library/PostgreSQL/8.3/data stop'
alias pg_restart='sudo -u postgres /Library/PostgreSQL/8.3/bin/pg_ctl -D /Library/PostgreSQL/8.3/data restart'
alias pg_reload='sudo -u postgres /Library/PostgreSQL/8.3/bin/pg_ctl -D /Library/PostgreSQL/8.3/data reload'
##
# don't hack my warez while i'm peeing
##
alias lock="/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment