Aliases for command line
These are mine aliases for command line that I use regularly. I use fish shell by the way. For bash or zsh the syntax may differ slightly.
# File operations
alias cp='cp -v'
alias rm='rm -I'
# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias dl='cd ~/Downloads'
alias dv='cd ~/Developer'
alias dw='cd ~/Developer/workspace'
alias home='cd ~/'
# Git alias
alias g='git'
alias gs='git status'
alias gc='git commit'
alias gp='git pull'
# Node package managers
alias yi='yarn install'
alias pi='pnpm install'
alias yd='yarn dev'
alias pd='pnpm dev'
alias yb='yarn build'
alias pb='pnpm build'
# Fancy ls using eza (https://github.com/eza-community/eza)
alias ls='eza -la --git --icons'
alias ll='eza -la --git --icons'
alias lsd='ls -lF'
# grep with color
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Cat with syntax highlighting (https://github.com/sharkdp/bat)
alias cat='bat'
# fzf
# fuzzy find file and open it with nvim
alias fzp='nvim $(fzf --preview="bat --color=always {}")'
# List all process
alias lsp='lsof -n -i | fzf'
# fuzzy search directory in workspace folder
# https://github.com/sharkdp/fd
alias fsd="fd -t d . ~/Developer/workspace/ --no-hidden | fzf --height 50% --border --preview 'ls -la {}'"
# Git with fzf
# Switch branch with interactive selection
alias gco="git checkout (git branch -a | fzf | tr -d ' *')"
# Interactive git log
alias gl="git log --oneline --decorate --color=always | fzf --ansi --preview 'git show {1}' | awk '{print \$1}' | xargs git show"
# interactive stash
alias gstash='git stash list | fzf --preview="git stash show -p (string split ':' {} | head -n1)" | string split ':' | head -n1 | xargs -r git stash show -p'
# History
alias fh="eval (history | fzf)"
# Search and install brew packages
alias fbrew="brew search '' | fzf | xargs brew install"
# Uninstall brew packages
alias funbrew="brew list | fzf | xargs brew uninstall"
# List installed brew packages
alias lbrew="brew list | fzf --preview='brew info {}'"
# env
alias fenv="env | fzf"The fish documentation on aliases can be found here.