2017-06-12 16:22:05 +02:00
|
|
|
###########################
|
|
|
|
#### 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"
|
2017-11-10 01:24:10 +01:00
|
|
|
|
2017-06-12 16:22:05 +02:00
|
|
|
## Quicklook shortcut
|
|
|
|
alias quicklook='qlmanage -px 2>/dev/null'
|
2017-11-10 01:24:10 +01:00
|
|
|
alias ql='quicklook'
|
|
|
|
|
2017-06-12 16:22:05 +02:00
|
|
|
## Airport command line interface
|
|
|
|
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport'
|
2017-11-10 01:24:10 +01:00
|
|
|
|
2017-06-12 16:22:05 +02:00
|
|
|
## Set an English locale to awk (default is italian, with commas as decimal separators)
|
|
|
|
alias awk='LC_ALL=en_DK awk'
|
2017-11-10 01:24:10 +01:00
|
|
|
|
2017-06-12 16:22:05 +02:00
|
|
|
## 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
|
2018-02-15 00:58:51 +01:00
|
|
|
alias lsrt='ls -G -lrt | tail -5'
|
2017-06-12 16:22:05 +02:00
|
|
|
## Add opened files to Textmate's recent menu item
|
|
|
|
alias mate='mate --recent'
|
|
|
|
fi
|
|
|
|
|
|
|
|
####
|
|
|
|
#### Easier life (everything)
|
|
|
|
#### Audible bell
|
|
|
|
alias bell='echo -en "\007"'
|
|
|
|
|
2018-03-31 02:33:42 +02:00
|
|
|
alias grep="grep --colour=yes"
|
2017-07-14 21:20:20 +02:00
|
|
|
|
2017-06-12 16:22:05 +02:00
|
|
|
##############
|
|
|
|
## 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
|
2018-02-15 00:58:51 +01:00
|
|
|
if [[ ! "$(uname)" == "Darwin" ]]; then
|
|
|
|
alias lsrt="ls -lrt | tail -10"
|
|
|
|
fi
|
2017-06-12 16:22:05 +02:00
|
|
|
|
2017-11-10 01:24:10 +01:00
|
|
|
## List open connections, TCP and UDP
|
2017-07-14 21:20:20 +02:00
|
|
|
alias listconnections="lsof -n -i TCP -i UDP"
|
2017-06-12 16:22:05 +02:00
|
|
|
## 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
|
2017-11-10 01:24:10 +01:00
|
|
|
alias ssh1="ssh -o ControlMaster=no"
|
2017-06-12 16:22:05 +02:00
|
|
|
|
|
|
|
|
2017-07-14 21:20:20 +02:00
|
|
|
# Some colorizing options for grc
|
2017-08-08 10:38:27 +02:00
|
|
|
if [[ "$TERM" != dumb ]] && [[ -f $(which grc) ]] ; then
|
2017-07-18 15:57:26 +02:00
|
|
|
# Prevent grc aliases from overriding zsh completions.
|
|
|
|
setopt COMPLETE_ALIASES
|
|
|
|
|
|
|
|
# Supported commands
|
|
|
|
cmds=(
|
2017-11-10 01:24:10 +01:00
|
|
|
ls \
|
2017-07-18 15:57:26 +02:00
|
|
|
cc \
|
|
|
|
configure \
|
|
|
|
cvs \
|
|
|
|
df \
|
|
|
|
diff \
|
|
|
|
dig \
|
|
|
|
gcc \
|
|
|
|
gmake \
|
|
|
|
ifconfig \
|
2018-03-31 02:33:42 +02:00
|
|
|
iptables \
|
2017-07-18 15:57:26 +02:00
|
|
|
last \
|
|
|
|
ldap \
|
|
|
|
make \
|
|
|
|
mount \
|
|
|
|
mtr \
|
|
|
|
netstat \
|
|
|
|
ping \
|
|
|
|
ping6 \
|
|
|
|
ps \
|
2018-03-31 02:33:42 +02:00
|
|
|
ss \
|
2017-07-18 15:57:26 +02:00
|
|
|
traceroute \
|
|
|
|
traceroute6 \
|
|
|
|
wdiff \
|
|
|
|
);
|
|
|
|
|
|
|
|
# Set alias for available commands.
|
|
|
|
for cmd in $cmds ; do
|
2017-08-08 10:38:27 +02:00
|
|
|
if [[ -f $(which $cmd) ]] ; then
|
2018-03-31 02:33:42 +02:00
|
|
|
alias $cmd="grc --colour=on $cmd"
|
2017-07-18 15:57:26 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Clean up variables
|
|
|
|
unset cmds cmd
|
2017-07-14 21:20:20 +02:00
|
|
|
fi
|
2017-06-12 16:22:05 +02:00
|
|
|
|
|
|
|
if [[ -f ~/.dotfiles_aliases ]];
|
|
|
|
then
|
|
|
|
source ~/.dotfiles_aliases
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|