1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-22 03:21:30 +01:00
dotfiles/aliases.sh

102 lines
2.9 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'
else
alias ls='ls --color'
fi
####
#### Easier life (everything)
alias dot="cd $DOTFILES"
#### Audible bell
alias bell='echo -en "\007"'
alias grep="grep --colour=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"
alias ipy='ipython'
alias ipyl='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'
# 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)'"
alias gl5='git log -n 5'
alias pvim='poetry run vim'
# 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
alias powerline_update="pip install --upgrade --user 'git+https://github.com/powerline/powerline.git@develop#powerline'"
alias gcf='git commit --fixup=HEAD'
alias gcaf='git commit -a --fixup=HEAD'
alias gls="git log --pretty=oneline --abbrev-commit" # gls: Git Log Short
alias watcha='watch ' # note the space after watch. This makes watch work with aliases
# A short version of docker ps
alias dps='docker ps --format "table {{.Image}}\t{{.RunningFor}}\t{{.Status}}\t{{.Ports}}\t{{.Names}}"'
# Get ip for a docker container, usage: `docker inspect <container> | dockerip`
alias dockerip="jq -r '.[].NetworkSettings.Networks.bridge.IPAddress'"
alias pvim='poetry run vim'
alias pshell='poetry shell'
# dotfiles user aliases
if [[ -f ~/.dotfiles_aliases ]]; then
source $HOME/.dotfiles_aliases
fi
# source ssh aliases
if [[ -f $HOME/.ssh_aliases ]]; then
source $HOME/.ssh_aliases
fi