dotfiles/aliases.sh

110 lines
2.7 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='qlmanage -px'
## Airport command line interface
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport'
## Set an English locale to awk (default is italian, with commas as decimal separators)
alias awk='LC_ALL=en_DK awk'
## 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
## Add opened files to Textmate's recent menu item
alias mate='mate --recent'
fi
####
#### Easier life (everything)
#### Audible bell
alias bell='echo -en "\007"'
alias grep="grep --color=auto"
##############
## 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"
## Go up one directory or several (with integer argument)
alias upcd='. upcd.sh'
## Show the last 10 modified files
alias lsrt="ls -lrt | tail -10"
#####################
#### New features
#####################
## List open connections, TCP and UDP
alias listconnections="lsof -n -i TCP -i UDP"
## Stress (run stress &>/dev/null &)
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"
# Some colorizing options for grc
GRC=`which grc`
if [ "$TERM" != dumb ] && [ -n "$GRC" ]
then
alias colourify="$GRC -es --colour=auto"
alias configure='colourify ./configure'
alias diff='colourify diff'
alias make='colourify make'
alias gcc='colourify gcc'
alias g++='colourify g++'
alias as='colourify as'
alias gas='colourify gas'
alias ld='colourify ld'
alias netstat='colourify netstat'
alias ping='colourify ping'
alias traceroute='colourify /usr/sbin/traceroute'
alias head='colourify head'
alias tail='colourify tail'
alias dig='colourify dig'
alias mount='colourify mount'
alias ps='colourify ps'
alias mtr='colourify mtr'
fi
if [[ -f ~/.dotfiles_aliases ]];
then
source ~/.dotfiles_aliases
fi