Skip to content

Instantly share code, notes, and snippets.

@wzulfikar
Last active January 20, 2023 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wzulfikar/87b13c0bec3681e6dafdc76416e1cb8a to your computer and use it in GitHub Desktop.
Save wzulfikar/87b13c0bec3681e6dafdc76416e1cb8a to your computer and use it in GitHub Desktop.
Shell aliases I use every day.
alias zshso="source ~/.zshrc"
alias clr="clear"
alias hist=history
alias ytdl="youtube-dl" # Example: ytdl https://www.youtube.com/watch?v=BBJa32lCaaY
alias graph="graph-easy" # Example: echo '[a],[c]->[b]' | graph --as=boxart
alias pn="pnpm" # Example: pn i (install packages from package.json)
alias cat="bat -p" # Replace cat with bat (plain style)
alias catt="bat" # Use fully styled bat
alias catp="/bin/cat" # Escape hatch to run the original `cat`
alias bdiff="git diff"
alias lgit="lazygit"
alias ldocker="lazydocker"
alias ff="fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"
alias rgf="rg --files | rg" # Find files using ripgrep. Example: rgf some-file
alias bcn="bacon" # 'bacon' is Rust background code runner
# iterm aliases
alias imcat="~/.iterm2/imgcat" # Example: imcat ~/Download/my-image.png
alias imls="~/.iterm2/imgls"
# common git aliases
alias clone="git clone"
alias commit="git commit"
alias add="git add"
alias pull="git pull"
alias push="git push"
alias status="git status"
alias gl="git log --graph --date=format:'%Y-%m-%d %H:%M' --pretty=format:'%Cblue%>(12)%ad %C(yellow)%h %Cgreen%<(7)%aN%Cred%d %Creset%s'"
alias co="git checkout"
alias stash="git stash"
alias rebase="git rebase"
alias reset="git reset"
alias merge="git merge"
alias bisect="git bisect"
alias rustface=~/code/playground/rustface/target/release/rustface
@wzulfikar
Copy link
Author

wzulfikar commented Oct 14, 2022

Run this command to add the aliases to your shell (supports bash or zsh):

curl https://gist.githubusercontent.com/wzulfikar/87b13c0bec3681e6dafdc76416e1cb8a/raw > ~/.aliases
function add_aliases() {
  local rc_file="$1"
  if [ -f $rc_file ]; then
    if [ -z "$(grep 'source ~/.aliases' $rc_file)" ]; then
      echo 'source ~/.aliases' >> $rc_file
      echo 'Aliases added to .zshrc'
    fi
    source $rc_file
  fi
}
add_aliases ~/.zshrc
add_aliases ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment