Dotfiles & Shortcuts

March 8, 2021

I am pretty obsessed with optimizing my workflows. Here are a collection of aliases & functions which help to work fast and type less.

Instant Shortcuts

Custom function I wrote to create a shortcut to a directory on the fly.

function createShortcut() {
    CMD=$1 # grab the current directory
    NEW_SHORTCUT="alias ${CMD}='cd ${DIR}'" #create alias string
    if  grep -q "$NEW_SHORTCUT" "$FILE" ; then
          echo "> alias '${NEW_SHORTCUT}' already exists"
          echo $NEW_SHORTCUT >> $FILE #add if it dosen't already exist!
          echo "> alias created: '${NEW_SHORTCUT}"
          source $FILE
# Example
> createShortcut components
> createShortcut frontend

Git Helpers

Making common git workflows easier

alias gpull='git pull origin $(git rev-parse --abbrev-ref HEAD)'
alias gpush='git push origin $(git rev-parse --abbrev-ref HEAD)'
alias b="git branch --sort=-committerdate"


Making life easier working in Tmux

alias tn='tmux new -s'
alias ta='tmux attach -t'
alias tad='tmux attach -d -t'
alias tkss='tmux kill-session -t'
alias tksv='tmux kill-server'
alias tl='tmux list-sessions'


Easy to forget kubectl commands

alias k="kubectl"
alias kvk='kubectl-vagrant -n kube-system'
alias kv='kubectl-vagrant'
alias whichcontext='kubectl config current-context'
alias kcc='kubectl config current-context'
alias kd='kubectl describe'
alias klogs='kubectl logs -f'
alias kfindpod='kubectl get pods'
alias kfinddep='kubectl get deployment --all-namespaces'
alias kdescribepod="kubectl -n research describe pod"