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

102 lines
2.9 KiB
Bash
Raw Normal View History

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
## 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'
else
alias ls='ls --color'
2017-06-12 16:22:05 +02:00
fi
####
#### Easier life (everything)
2020-03-08 23:50:14 +01:00
alias dot="cd $DOTFILES"
2017-06-12 16:22:05 +02:00
#### Audible bell
alias bell='echo -en "\007"'
2020-04-10 20:42:37 +02:00
alias grep="grep --colour=auto"
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"
2020-04-10 20:42:37 +02:00
alias ipy='ipython'
alias ipyl='ipython --pylab'
2017-06-12 16:22:05 +02:00
## 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
## Stress one CPU core
2017-06-12 16:22:05 +02:00
alias stress='yes >> /dev/null'
# 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
2020-02-14 16:37:43 +01:00
# git: useful_stuff
alias git_sort_branches_by_date="git for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'"
2020-04-21 17:25:07 +02:00
alias gl5='git log -n 5'
2020-02-14 16:37:43 +01:00
2020-04-21 17:25:07 +02:00
alias pvim='poetry run vim'
2017-06-12 16:22:05 +02:00
# grc: try to source the definitions file in /etc/grc.zsh (print a warning if it does not exist)
2020-02-14 16:37:48 +01:00
if [[ -f /etc/grc.zsh ]] ; then
source /etc/grc.zsh
2020-02-14 16:37:48 +01:00
elif [[ -f /usr/local/etc/grc.zsh ]] ; then
2020-02-14 16:37:47 +01:00
source /usr/local/etc/grc.zsh
else
2020-02-14 16:37:48 +01:00
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
2017-07-14 21:20:20 +02:00
fi
2017-06-12 16:22:05 +02:00
2020-03-09 17:54:16 +01:00
alias powerline_update="pip install --upgrade --user 'git+https://github.com/powerline/powerline.git@develop#powerline'"
2020-03-10 15:29:47 +01:00
alias gcf='git commit --fixup=HEAD'
alias gcaf='git commit -a --fixup=HEAD'
2020-04-09 04:17:26 +02:00
alias gls="git log --pretty=oneline --abbrev-commit" # gls: Git Log Short
2020-03-10 15:29:47 +01:00
alias watcha='watch ' # note the space after watch. This makes watch work with aliases
2020-03-30 03:37:11 +02:00
# 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'"
2020-03-30 03:37:11 +02:00
2020-11-16 01:46:01 +01:00
alias pvim='poetry run vim'
alias pshell='poetry shell'
# dotfiles user aliases
if [[ -f ~/.dotfiles_aliases ]]; then
2019-12-07 22:32:14 +01:00
source $HOME/.dotfiles_aliases
2017-06-12 16:22:05 +02:00
fi
# source ssh aliases
if [[ -f $HOME/.ssh_aliases ]]; then
source $HOME/.ssh_aliases
fi