dotfiles/aliases.sh

87 lines
2.3 KiB
Bash
Executable File

###########################
#### ALIAS #
###########################
####
#### Easier life (MAC SPECIFIC)
####
if [[ "$(uname)" == "Darwin" ]]; then
alias o="open"
alias ls="ls -G"
## Colorize system.log contents (with grc), and inspect with less.
alias console="grc cat /var/log/system.log | sort -r | less -R"
## Quicklook shortcut
alias quicklook='qlmanage -px 2>/dev/null'
alias ql='quicklook'
## Airport command line interface
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport'
## Flush dns cache
#alias dnsflushcache='sudo discoveryutil mdnsflushcache' # used to work until 10.6
alias dnsflushcache='sudo killall -HUP mDNSResponder' # Works up until 10.9 and after 10.10.4
alias lsrt='ls -G -lrt | tail -5'
## Add opened files to Textmate's recent menu item
alias mate='mate --recent'
else
alias ls='ls --color'
fi
####
#### Easier life (everything)
#### Audible bell
alias bell='echo -en "\007"'
alias grep="grep --colour=yes"
##############
## ls aliases
############
# ls -al, only show files that start with a dot
alias lsdot="ls -al | awk '\$9 ~ /^\./ {print \$0}'"
alias lt='ls -lrt | tail -10'
alias ll='ls -lhL' #long ls output
alias ka="killall"
## Load pylab by default when running ipython
alias ipy="ipython --pylab"
## Show the last 10 modified files
if [[ ! "$(uname)" == "Darwin" ]]; then
alias lsrt="ls -lrt | tail -10"
fi
## Stress one CPU core
alias stress='yes >> /dev/null'
# use textmate to diff two files
alias mdiff="mate -t source.diff"
###########################
#### SSH Tunnels #
###########################
# define ssh without controlmaster
alias ssh1="ssh -o ControlMaster=no"
# git: useful_stuff
alias git_sort_branches_by_date="git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
# grc: try to source the definitions file in /etc/grc.zsh (print a warning if it does not exist)
if [[ -f /etc/grc.zsh ]] ; then
source /etc/grc.zsh
elif [[ -f /usr/local/etc/grc.zsh ]] ; then
source /usr/local/etc/grc.zsh
else
echo "Could not grc completion file (checked /etc/grc.zsh and /usr/local/etc/grc.zsh. Command colorization will not work. Check your grc configuration (is grc installed?)" 1>&2
fi
# dotfiles user aliases
if [[ -f ~/.dotfiles_aliases ]];
then
source $HOME/.dotfiles_aliases
fi