Replacing ls with exa in my Linux workflow

As always, I may be a few years behind the latest cool trends, but I just found this tool and I had to write about it. It is called exa, it can be easily installed in Fedora using sudo dnf install exa (or with rpm-ostree install exa for Silverblue users) and it’s a file listing tool. At first I thought “Ok, so what? There is nothing wrong with ls, why would I need a replacement?”. Or even: “Since we have ls, why would anybody work on anything that would replace it?”.

But as I started testing exa and learned about its features, I immediately recognized its usefulness and decided to write about it. Maybe someone out there appreciates the nice output it provides and finds it important for their workflow. If you want to make your own opinion before fully committing to it, you can install it in a toolbox container. If you don’t like it you can throw the container away and forget it ever happened.

Features and benefits

First of all, if you simply run exa the output will be identical with ls. Also, some options may resemble the options from ls, such as -l:

Yes, exa is a bit more colored by default and that may be helpful, but the real differences start to show up as we dwell on the documentation. For example exa provides a nice tree output by simply using --tree:

But it goes further if we use both -l and --tree:

You can set the tree depth by using the --level parameter:

It can also display the output header by adding -h:

And if you look closely at the ls -l output you will see it also shows the group owner of the file, which we can replicate with exa by adding the -g parameter:

Sorting, icons and dates

We managed to have a more colorful ls output but this cannot be in itself a reason to replace it. Let’s check some more interesting options:

Look, I know this is as close to a gimmick as possible but sometimes icons do make a difference. For example if we look at the particle-optimization folder we can immediately distinguish the file types by icon:

Icons only work for fonts that support them of course. In my case, Ubuntu Mono breaks no sweat with them. We can also group folders at the top by using the --group-directories-first parameter, a feature I always enable in Gnome Files for example:

We can also choose to display the date in an easy to understand ISO format using the --time-style=long-iso parameter:

There are a few more options for the time style: iso which gives a short date output and full-iso which gives the full timestamp down to the millisecond. Next we can sort using the --sort parameter, for example:

We can sort by date modified:

And we can reverse the sort by adding --reverse:

Git integration

The best trick though is the git integration. We can display git data by adding the --git parameter:

Of course this can be replaced by good old git status which will show everything in a much better output, but having this information along the file output just feels right when displaying a git bound folder.

Creating an alias for exa

If all of the above convinced you to switch to exa, Fedora has an alias that I always use, namely ll. I am so used to ll that I rarely type the full ls -l anymore. This also makes it a great candidate to replace with exa:

#alias ll="exa -lgh --time-style=long-iso --group-directories-first --icons"

The above command will switch the ll alias to exa, allowing us to simply type ll and get all the benefits of the nice exa output. If we want to make it permanent, we simply need to add the alias to our .bashrc file:

After configuring a nice output for exa, it was hard for me to return to ls. I feel like exa is one of those tools that add features so seamlessly that you don’t really feel you need them but once they are there, it’s hard to let go. I say this especially for the folder grouping, icons and git integration. Sure, none of these features are showstoppers, but they are very nice to have.

If your console font does not support Unicode icons, try Ubuntu Mono or you can download patched fonts that have icons added from Nerd Fonts.

That’s all for today. This tool really got me by surprise, I very rarely switch default Linux tools for third party ones. I hope you will find it useful too! See you next time!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store