1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-04 16:51:31 +01:00
dotfiles/aliases/aliases.zsh
2024-04-06 21:24:45 +02:00

89 lines
2.4 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"
alias grepi="grep -i"
##############
## 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'
alias treep='tree -I __pycache__'
## 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'
# ssh forcing a new connection (no persistent)
alias ssh1="ssh -o ControlMaster=yes -o ControlPersist=no"
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'
alias venv='source .venv/bin/activate'
# Run fzf with file preview
alias pf="fzf --preview='BAT_STYLE='header,changes' bat --color=always {}' --bind shift-up:preview-page-up,shift-down:preview-page-down"
# dvc
alias dst='dvc status'
alias dstc='dvc status --cloud'
alias drp='dvc repro'
alias drps='dvc repro -s'
alias -g J="| jq "
# These two depend on oh-my-zsh's clipcopy/clippaste functions
alias -g C='| clipcopy'
alias -g P='clippaste'