Create alias

2 snippets across 2 stacks — Bash & Linux, Git

SHBash & Linux

Create Command Aliases

SH · Shortcuts & Productivity
syntax
alias name='command'
unalias name
example
alias ll='ls -lah'
alias gs='git status'
alias dc='docker compose'
alias k='kubectl'
alias myip='curl -s ifconfig.me'

Note Aliases defined in the terminal are lost when the shell exits. Add them to ~/.bashrc or ~/.zshrc to make them permanent. Run alias with no arguments to list all current aliases. Use unalias to remove one.

GitGit

Create Aliases

Git · Setup & Config
syntax
git config --global alias.<shortcut> '<command>'
example
git config --global alias.co 'checkout'
git config --global alias.br 'branch'
git config --global alias.lg 'log --oneline --graph --all'

# Now use:
git co main
git lg

Note Aliases are stored in ~/.gitconfig. You can also edit that file directly under the [alias] section for complex aliases.