#!/bin/bash # vim: set ft=sh alias cdp="cd -" alias ..='cd ..' alias pd="pushd $1" # list files alias ll='ls -hGla' #rake alias bake='bundle exec rake' #tools alias resrc='source ~/.bash_aliases && source ~/.bashrc && source ~/.profile' alias role='whoami -groups -fo list | grep -i' alias fu='find ./ -type f -print0 | xargs -0 grep -n $1' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' #git alias gs='git status' alias gm='git merge --ff-only' alias gpr='git pull --rebase' alias gmt='git mergetool' alias grc='git rebase --continue' alias gk='git fetch origin; git remote prune origin; gitk --all &' alias gl='git log --pretty=format:"%h %ar by %an: %s"' # Get week number alias week='date +%V' # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport' # Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update' # IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias localip="ipconfig getifaddr en0" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" # Empty the Trash on all mounted volumes and the main HDD # Also, clear Appleā€™s System Logs to improve shell startup speed alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" # Show/hide hidden files in Finder alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" # Recursively delete `.DS_Store` files alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" # Hide/show all desktop icons (useful when presenting) alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" # Stuff I never really use but cannot delete either because of http://xkcd.com/530/ alias stfu="osascript -e 'set volume output muted true'" alias pumpitup="osascript -e 'set volume 7'" # # Kill all the tabs in Chrome to free up memory # [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill" # Lock the screen (when going AFK) alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" # go alias sgobuild="CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w'"