CLI aliases to boost your productivity

February 15, 2022

Over the years, I've been putting together a list of terminal aliases. I rely on them every day, and I figured it might also be helpful to others!

As I'm a front-end developer, some of these aliases will not speak to our backender or DevOps friends. Feel free to adapt these to your liking!

Bash / Zsh

You can add these aliases to your .bashrc or .zshrc file. Or check out my full .zshrc

You don't know what shell you're rocking or how to edit your configuration? Run this command in your favourite terminal: echo $SHELL. It will output /bin/bash or /bin/zsh, which means you'll have to respectively edit ~/.bashrc or ~/.zshrc.

Open code editors

alias sublime="open -a /Applications/Sublime\"
alias code="open -a Visual\ Studio\"

Navigate and view files (using exa)

List all files/folders:

alias ls="exa -la --git --group-directories-first"

List all folders:

alias lsd="exa -laD --git"

Show a tree view of a directory:

alias lst="exa -T --group-directories-first -I=".git|.history|node_modules""

Show a tree view of your folder structure:

Tip: you want to limit depth? Just append -L <level_number> like lstd -L 2

alias lstd="exa -DT -I=".git|.history|node_modules""

Remove a folder and its content:

alias rmf="rm -rf"

Use everyday tools in a keystroke (or two)

alias g="git"
alias y="yarn"
alias n="npm"
alias d="docker"
alias dc="docker-compose"

Get your public ip

alias ip="curl []("


You can add the examples below to the [alias] section of your .gitconfig. Or you can check my full .gitconfig.

Basic command shortcuts:

ci = commit
cim = commit -m
co = checkout
st = status -s
cp = cherry-pick
po = push origin
diff = diff --word-diff

Show git log with relative dates:

lg = log --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'

Show tree-like git log:

lgt = log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'

Update your last commit with staged files without editing the commit message:

oops = commit --amend --no-edit

Ensure that force-pushing won't lose someone else's work (only mine):

pwl = push --force-with-lease

Edit last commit message:

reword = commit --amend

Undo the last commit but keep changed files in stage:

uncommit = reset --soft HEAD~1

Stash operations:

sl = stash list
sa = stash apply
sp = stash pop
ss = stash save

Show all your git aliases:

aliases = "!git config -l | grep alias | cut -c 7-"


1. is not an alias, more of an autocompletion tool on steroids. You can set it up and enjoy the built-in features: npm, git, docker, ssh, etc.

And if that's not enough for you, you can even write your own shortcuts.

1. Yet Another Dotfiles Manager (yadm)

Now that you have these shiny aliases set up, it would be a shame to lose them or have to reconfigure them one by one on a new computer, right?

Enters yadm: a simple tool that makes it easy to share your dotfiles. If you know git, setting up yadm will be pretty straightforward. Soon enough, you'll feel at $HOME anywhere in a matter of seconds!