2010-06-27 01:12:01 +10:00
|
|
|
alias gi='sudo gem install'
|
2009-06-11 09:54:54 +10:00
|
|
|
alias ls='ls -FG'
|
2009-03-20 00:08:06 +11:00
|
|
|
alias ll='ls -lah'
|
|
|
|
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
|
|
|
|
alias ...='.. ..'
|
|
|
|
alias g='grep -i' #case insensitive grep
|
|
|
|
alias h='history|g'
|
|
|
|
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
|
|
|
|
alias top='top -o cpu'
|
2009-03-26 23:59:07 +11:00
|
|
|
alias o='open .'
|
2009-03-20 00:08:06 +11:00
|
|
|
alias et="m"
|
|
|
|
|
2010-06-27 01:12:01 +10:00
|
|
|
alias sprof="reload"
|
|
|
|
|
2009-03-20 00:08:06 +11:00
|
|
|
alias home='cd ~' # the tilda is too hard to reach
|
2009-04-26 16:55:34 +10:00
|
|
|
alias systail='tail -f -n0 /var/log/system.log'
|
|
|
|
alias aptail='tail -f -n0 /var/log/apache*/*log'
|
|
|
|
alias l='ls'
|
|
|
|
alias b='cd -'
|
2009-06-13 11:48:28 +10:00
|
|
|
|
2009-03-20 00:08:06 +11:00
|
|
|
alias c='clear' # shortcut to clear your terminal
|
2009-04-26 16:55:34 +10:00
|
|
|
|
2009-03-20 00:08:06 +11:00
|
|
|
# useful command to find what you should be aliasing:
|
|
|
|
alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr"
|
|
|
|
|
|
|
|
# rails stuff
|
|
|
|
alias log='tail -f -0 ./log/*.log'
|
|
|
|
alias ss='ruby ./script/server'
|
|
|
|
alias sc='ruby ./script/console'
|
2010-06-27 01:12:01 +10:00
|
|
|
alias gen='script/generate'
|
2009-03-20 00:08:06 +11:00
|
|
|
alias migration='script/generate migration'
|
2010-06-29 21:44:08 +10:00
|
|
|
alias migrate='rake db:migrate && rake db:migrate RAILS_ENV=test'
|
2009-03-20 00:08:06 +11:00
|
|
|
alias rollback='rake db:rollback'
|
2009-04-26 16:55:34 +10:00
|
|
|
alias r='rake'
|
2009-06-10 13:02:44 +10:00
|
|
|
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
2009-03-20 00:08:06 +11:00
|
|
|
|
2009-06-10 13:02:44 +10:00
|
|
|
alias pubkey='cat ~/.ssh/*.pub'
|
2009-03-20 00:08:06 +11:00
|
|
|
|
|
|
|
# replacement netstat cmd to find ports used by apps on OS X
|
|
|
|
alias netstat="sudo lsof -i -P"
|
|
|
|
|
|
|
|
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
|
|
|
|
2009-03-20 00:28:02 +11:00
|
|
|
function f() { find * -name $1; }
|
2010-06-27 01:12:01 +10:00
|
|
|
function p() {
|
|
|
|
cd $* && m
|
|
|
|
}
|
|
|
|
function m() {
|
|
|
|
if [ -n "$*" ]; then
|
|
|
|
files=$*
|
|
|
|
else
|
|
|
|
files=.
|
|
|
|
fi
|
|
|
|
mate -l1 $files 2>/dev/null
|
|
|
|
}
|
2009-03-20 00:08:06 +11:00
|
|
|
|
2009-06-10 13:02:44 +10:00
|
|
|
function extract() {
|
|
|
|
if [ -f $1 ] ; then
|
|
|
|
case $1 in
|
|
|
|
*.tar.bz2) tar xvjf $1 ;;
|
|
|
|
*.tar.gz) tar xvzf $1 ;;
|
|
|
|
*.bz2) bunzip2 $1 ;;
|
|
|
|
*.rar) unrar 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
|
|
|
|
}
|
2009-03-20 00:28:02 +11:00
|
|
|
|
2010-06-27 01:37:43 +10:00
|
|
|
if [ `uname` = "Darwin" ]; then
|
|
|
|
function prompt_pwd() {
|
|
|
|
if [ "$PWD" != "$HOME" ]; then
|
|
|
|
printf "%s" `echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
|
|
|
echo $PWD|sed -e 's-.*/\.\{0,1\}[^/]\([^/]*$\)-\1-'
|
|
|
|
else
|
|
|
|
echo '~'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
else # defined two for diff systems because Fish did (not entirely sure why)
|
|
|
|
function prompt_pwd() {
|
|
|
|
case "$PWD" in
|
|
|
|
$HOME)
|
|
|
|
echo '~'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
printf "%s" `echo $PWD|sed -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
|
|
|
echo $PWD|sed -n -e 's-.*/\.\{0,1\}.\([^/]*\)-\1-p'
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-25 17:02:29 +10:00
|
|
|
if [ $system_name = 'Darwin' ]; then
|
2009-04-26 16:55:34 +10:00
|
|
|
function manpdf() { man -t $@ | open -f -a Preview; }
|
|
|
|
function osinfo() {
|
|
|
|
x1="$(/usr/bin/sw_vers -productName)"
|
|
|
|
x2="$(/usr/bin/sw_vers -productVersion)"
|
|
|
|
x3="$(/usr/bin/sw_vers -buildVersion)"
|
|
|
|
x4="$(/usr/bin/arch)"
|
|
|
|
echo "${x1} - ${x2} - ${x3} - ${x4}"
|
|
|
|
}
|
2009-04-26 17:02:57 +10:00
|
|
|
alias ls='ls -G'
|
2010-06-26 11:05:10 +10:00
|
|
|
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
|
2009-04-26 16:55:34 +10:00
|
|
|
alias et="m"
|
|
|
|
alias o='open .'
|
2010-06-26 11:27:40 +10:00
|
|
|
alias eprof="mate ~/.config"
|
2009-04-26 16:55:34 +10:00
|
|
|
alias hidefile='/usr/bin/SetFile -a "V"'
|
|
|
|
alias showfile='/usr/bin/SetFile -a "v"'
|
|
|
|
alias startpg='sudo /Library/StartupItems/PostgreSQL/PostgreSQL start'
|
|
|
|
alias readrails="mate `ruby -rubygems -e "puts( ['rails', 'activerecord', 'activeresource', 'actionpack', 'activesupport'].collect { |gem| gems = Gem.source_index.find_name(gem); gems.last.full_gem_path; }.join(' '))"`"
|
2009-04-26 17:02:57 +10:00
|
|
|
else
|
|
|
|
alias ls='ls --color=auto'
|
2009-06-10 13:02:44 +10:00
|
|
|
fi
|