Make ls pretty with exa

I’m a big fan of exa. It turns your boring directory listings into this:

Installation

You can find the package in your favourite package manager. Here are the two most common:

brew install exa # MacOS
sudo apt install exa # Ubuntu

You also need special fonts for the icons. You can get one of the Nerd Fonts. I’m using Meslo Nerd Font.

Setting exa as a default

It’s hard to change your habits so I recommend overriding the ls command with exa. Put this into ~/.bashrc or ~/.zshrc so that every time you write ls, it will call exa instead and you get a beautiful directory listing.

alias ls="exa --color=auto --icons"

Bonus: Automatic ls when changing directories

The following snippet will automatically call ls when you change directories. Handy!

function chpwd() {
  emulate -L zsh
  ls -a
}