mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
211 lines
4.8 KiB
Bash
211 lines
4.8 KiB
Bash
# Common Aliases
|
|
alias -g ...=../..
|
|
alias -g ....=../../..
|
|
alias -g .....=../../../..
|
|
alias -g ......=../../../../..
|
|
|
|
alias ..la="cd ..;la"
|
|
alias ..ll="cd..;ll"
|
|
alias ..l="..ll"
|
|
|
|
alias l=ll
|
|
alias ll="ls -lFh"
|
|
alias la="ls -lAFh"
|
|
alias lat='la -t'
|
|
alias al=la # No, I don't need the Mono Assembly Linker
|
|
|
|
alias md="mkdir -p"
|
|
mcd(){
|
|
mkdir -p $1 && cd $1
|
|
}
|
|
alias grep='grep --color'
|
|
alias -g H='| head'
|
|
alias -g T='| tail'
|
|
alias -g G='| grep'
|
|
alias -g L="| less"
|
|
alias -g C="| wc -l"
|
|
alias -g S="| sort"
|
|
alias -g U="| uniq"
|
|
alias -g count="| wc -l"
|
|
alias -g NE="2> /dev/null"
|
|
alias -g NUL="&> /dev/null"
|
|
alias -g BG="&;disown"
|
|
alias -g COL="| column -t"
|
|
alias -g CLIP="| xclip -i -selection primary -f | xclip -i -selection clipboard"
|
|
calc() {
|
|
echo "$@" | bc -l
|
|
}
|
|
|
|
alias svi=sudoedit
|
|
# This will enable us to use aliases in sudo.
|
|
# (If alias finishes with a space or tab, the shell will check if the next command is also aliased.)
|
|
# Source: https://github.com/mayah/home/blob/master/.zsh/zshrc.d/alias.zsh
|
|
alias sudo='sudo '
|
|
alias open=xdg-open
|
|
|
|
# Command rewrites
|
|
alias ls='ls --color=always'
|
|
alias rm='rm -i'
|
|
alias mv='mv -i'
|
|
alias cp='cp -i'
|
|
alias less='less -R'
|
|
alias tree='tree --dirsfirst -C -F'
|
|
alias dd='dd status=progress'
|
|
|
|
# System aliases
|
|
alias s=systemctl
|
|
alias p=pacaur
|
|
alias ps='ps aux'
|
|
alias catn='tail -n +1 -- *.txt'
|
|
kl() { kill -9 `pidof $1` }
|
|
alias chx='chmod +x'
|
|
|
|
# File default aliases
|
|
pdf() {
|
|
evince $@ NE BG
|
|
}
|
|
alias -s pdf=pdf
|
|
alias -s zip="unzip -l"
|
|
alias -s rar="unrar l"
|
|
alias -s tar="tar tf"
|
|
alias -s tar.gz=echo
|
|
alias -s jar="java -jar"
|
|
alias -s git="git clone"
|
|
|
|
|
|
# Git Aliases
|
|
alias g=git
|
|
alias gcl="git clone --recursive"
|
|
alias gco="git checkout"
|
|
alias gcom="git checkout master"
|
|
alias ga="git add"
|
|
alias gaa="ga -A"
|
|
alias gc="git commit"
|
|
alias gcm="gc -m"
|
|
alias gcma="git commit --amend -m"
|
|
alias gcman="git commit --amend --no-edit -m"
|
|
alias gca="git commit --amend"
|
|
alias gcan="git commit --amend --no-edit"
|
|
alias gst="git status"
|
|
|
|
alias gm="git merge"
|
|
alias gma="git merge --abort"
|
|
alias grb="git rebase"
|
|
alias grba="grb --abort"
|
|
alias grbc="grb --continue"
|
|
|
|
alias gf="git fetch"
|
|
alias gp="git push"
|
|
alias gpf="gp --force"
|
|
alias gpup="git push --set-upstream"
|
|
alias gpupom="git push --set-upstream origin master"
|
|
alias gl="git pull --rebase"
|
|
alias glp="gl && gp"
|
|
gd() {
|
|
local commit=$1
|
|
if [ -z "$commit" ] || [ ${commit:0:1} != '@' ]; then
|
|
git diff $@
|
|
return
|
|
else
|
|
git diff "@~${commit:1}^!"
|
|
fi
|
|
}
|
|
alias gds="git diff --staged"
|
|
alias glg="git log --stat --color"
|
|
alias glog="git log --oneline --decorate --color --graph"
|
|
|
|
alias grst="git reset"
|
|
alias gundo="git reset @~1"
|
|
alias gclean="git clean"
|
|
alias gbr="git branch"
|
|
alias gr="git remote"
|
|
alias gra="gr add"
|
|
alias grr="gr rm"
|
|
alias grao="gra origin"
|
|
alias grro="grr origin"
|
|
|
|
alias gsta='git stash'
|
|
alias gstd='gsta drop'
|
|
alias gstl='gsta list'
|
|
alias gstp='gsta pop'
|
|
alias gstv="gsta show -p stash@{0}"
|
|
|
|
# Docker aliases
|
|
alias d=docker
|
|
alias dps='docker ps'
|
|
alias dpsa='docker ps -a'
|
|
alias drm='docker rm'
|
|
alias drmi='docker rmi'
|
|
alias dim='docker images'
|
|
alias dbl='docker build'
|
|
alias dbl.='docker build .'
|
|
alias drun='docker run -ti'
|
|
alias dkl='docker kill'
|
|
dklrm() { docker kill $1 ; docker rm $1 }
|
|
alias dst='docker stop'
|
|
alias drst='docker restart'
|
|
alias dnet='docker network'
|
|
alias dvol='docker volume'
|
|
alias dlg='docker logs -f'
|
|
alias dalpine='docker run -ti --rm alpine /bin/sh'
|
|
alias drm-stopped='docker rm -v $(docker ps -a -q -f status=exited)'
|
|
alias drmi-untag='docker rmi $(docker images -f "dangling=true" -q)'
|
|
alias dsh='_dsh exec'
|
|
alias drsh='_dsh "run --rm"'
|
|
_dsh() {
|
|
local dowhat="$1"
|
|
local user=`echo $2 | cut -d'@' -f1 -s`
|
|
local usercmd=""
|
|
if [ -z "$user" ]; then
|
|
host="$2"
|
|
else
|
|
host=`echo $2 | cut -d'@' -f2 -s`
|
|
usercmd="--user=$user "
|
|
fi
|
|
|
|
eval "docker $dowhat -ti $usercmd$host /bin/sh"
|
|
}
|
|
|
|
alias dm='docker-machine'
|
|
dm-con() {
|
|
eval $(docker-machine env $1)
|
|
}
|
|
alias dmc=dm-con
|
|
|
|
alias dc='docker-compose'
|
|
|
|
# ZFS aliases
|
|
alias zfs='sudo zfs'
|
|
alias zpool='sudo zpool'
|
|
alias z=zfs
|
|
alias zp=zpool
|
|
|
|
# Packer, Vagrant aliases
|
|
alias pk=packer
|
|
alias v=vagrant
|
|
|
|
# General Aliases
|
|
alias ssha='eval `ssh-agent` ; ssh-add'
|
|
alias aliases="$EDITOR $DOTFILES/aliases ; source ~/.zshrc"
|
|
alias vimrc="$EDITOR ~/.vimrc"
|
|
alias zshrc="$EDITOR ~/.zshrc ; source ~/.zshrc"
|
|
alias xinitrc="$EDITOR ~/.xinitrc"
|
|
alias xresources="$EDITOR ~/.Xresources ; xrdb merge ~/.Xresources"
|
|
alias xsession="$EDITOR ~/.xsession"
|
|
alias sshc="$EDITOR ~/.ssh/config"
|
|
alias dotfiles="cd $DOTFILES"
|
|
alias i3c="$EDITOR ~/.config/i3/config ; i3-msg restart"
|
|
alias i3bc="$EDITOR ~/.config/i3/blocks/config ; i3-msg restart"
|
|
i3b() {
|
|
$EDITOR ~/.config/i3/blocks/$@
|
|
}
|
|
alias sf=screenfetch
|
|
alias nf=neofetch
|
|
randstr() {
|
|
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
|
|
}
|
|
|
|
alias lab="ssh -tt tw '~/ctl' 2>/dev/null"
|
|
|
|
# vim: ft=sh
|