Zsh Aliases

about | blog | config | notes | github

Aliases let us create shortcuts for commonly used terminal commands within Zsh.

1. Aliases

Shortcuts for ls

alias ls="LC_COLLATE=C ls -F --color=always"
alias ll="ls -oh"
alias la="ls -lah"

Shell aliases to make using Git easier.

alias gs="git status"
alias ga="git add"
alias gc="git commit"
alias gd="git diff"
alias gds="git diff --staged"
alias gl="git log --graph --stat -p"
alias gp="git push"
alias gf="git fetch"
alias gm="git merge"
alias gb="git branch -av"

These aliases are weird. This was when the term I was using was causing issues with clear and other utilities like eselect. The problem however was that I couldn't just set the TERM to xterm globally as other utilities would also break.

alias clear="TERM='xterm' clear"
alias eselect="TERM='xterm' eselect"

Make various commands pretty by default

alias grep="grep --color=always"
alias tree="tree -C"

Misc things

alias fping="ping -c 3 www.google.com"
alias weather="curl wttr.in"

Ricing info commands

alias info="clear;echo;neofetch;colors;"
alias infos="info;scrot --delay 3 --count --quality 100 ~/tmp/myscrot.png"

Sudo improvements…

alias please="sudo"
if [ $UID -ne 0 ]; then
    alias fuck='eval "sudo $(fc -ln -1)"'
fi

Make certain commands safer to use by default

alias rm="rm -I --preserve-root"
alias mv="mv -i"
alias cp="cp -i"

This is just to configure vi to actually just be an alias pointing to the default editor I have set.

alias vi=$EDITOR # lmao

Add a custom alias for this because I dont ever remember this flag

alias emacs-cli="emacs -nw"

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)