Jan 11, 2023 4 min read

How to Install and Use exa on Linux

Table of Contents

The ls command is one of the basic yet essential Linux commands. You cannot imagine surviving the terminal without it.

And yet, there is a new tool that aims to be a replacement of the ls command. This new tool is exa.

list files in tree manner in linux

How audacious! But exa actually is full of intuitive features that you won't find in the ls command. Some of them are:

  • Colorful output
  • Grid, long, and tree view
  • Git integration
  • Display icons

Intrigued? Let me tell you how to install exa and use it.

Installing exa

You should get it in the official repositories of most distributions.

For Debian and Ubuntu-based distributions, use:

sudo apt install exa

If you are on an Arch-based distro, you should use:

pacman -S exa

For Fedora users, use the DNF command:

dnf install exa

Since exa is based on Rust, it can also be installed using the cargo package manager.

First set up cargo on Linux and then exa can easily be installed with the following command:

cargo install exa

If you want to take the matter into your hands, you can build it from the source by following their official documentation.

Using exa command

The best part is that the exa command syntax is pretty similar to the ls so there is no steep learning curve here.

The exa uses specific colors for specific file types.

So for your reference, I stacked multiple types of files in one directory and listed them in a tree manner which will indicate their colors:

exa -T
exa colors on linux

And as you can see, it indicated all the files using different colors such as compressed files are shown with bright orange and the documents are listed with lavender color.

Now, let's explore other use cases of exa.

Grid view

To enable the grid view, all you need to do is append the --grid flag with the exa command:

exa --grid

By default, it will sort the files respective to columns so you will see that numbers on the first column sort files.

Now, this behavior can be altered for rows in which the files will be sorted respective to columns using the --across flag:

exa --across
list files and sort them respective to rows in linux

And if you want to list the files in a single column, you can use the --oneline flag with the exa command:

exa --oneline

Long view

You can think of the long view as typical the ls -la output that brings permissions, filesize, etc.

To access the long view, all you need to do is append the --long flag with the exa command:

exa --long
list files with permissions and file size on linux

But it feels pretty plain and I prefer to have headers and an extra column specifying the user group.

To enable headers and a user group column, you'll have to add two extra flags --header and --group:

exa --long --header --group
enable headers and user group column on exa

And if you want to have a combination of list and grid view, you can append both --long and --grid to the exa command:

exa --long --grid
combine long and grid view using the exa command

Pretty cool. Right?

Tree display

exa can display the content like the tree command. To list files in the tree manner, all you need to do is append the -T option with the exa command:

exa -T
list files in tree manner in linux

Sort files

To sort files based on their size, you will have to use the --sort=size flag with the exa command:

exa --long --header --sort=size
sort files based on file size on linux

Similarly, you can use different options as following to sort :

Sorting Option Description
--sort=name Sort files based on names (Alphabetically).
--sort=acc Sort files based on when they were accessed.
--sort=cr Sort files based on the time they were created or changed.
--sort=mod Sort files based on the time of modification (from oldest to newest).
--sort=ext Sort files based on the filename's extension.

Wrapping Up

Exa is one of the modern alternatives to the legendary UNIX commands.

Modern Alternatives to Some of the Classic Linux Commands
When you start learning Linux, you begin with a standard set of Linux commands that have been in existence since the UNIX days. As you grow old as a Linux user, you keep on mastering the same set of standard commands. But these standard, legacy commands were created several decades

In my opinion, the ls command is a classic and cannot be replaced. The exa command gives an option to Linux users who completely control their system.

For sysadmins who have to work on different servers in different environments, relying on exa won't be possible. The ls command is omnipresent, exa is not.

Still, it is good to see such modern takes on the classic Linux commands.

Sagar Sharma
A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Linux Handbook.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.