exa: Next-gen listing command in Linux for pro

A new generation is coming up with an alternative version of conventional commands. Can we accept them to replace the legacy of Richard M. Stallman and David MacKenzie? Does it have the necessary changes that can bend us to move with a new command?

I have pulled out the exa command from the plethora of alternative commands, which claims to be a modern tool of the “ls” command.

And in this article, you will find why you should use exa instead of ls, installation steps, and the basic usage of the exa command to list out files.

What is exa, and why should you switch to exa?

An exa command is an alternative way to list out the files from your file system, which is similar to the ls command that you have learned in your initial days to list out files in various ways with different options.

Alright, but why should I consider exa over ls? The same question I was asking myself and got the answer and reasons are simple enough to choose exa:

  • Default exa command does not require many options compared to ls by default.
  • Bye-Bye white text output with colorful output and leverage metadata data to distinguish file types.
  • It supports file icons too.
  • exa queries request in parallel to list out files.
  • Inbuilt tree & grid view support
  • Git support is included, which means you do not need to invoke the git-status command to check staged or unstaged files.

Installation of exa command in Linux

You can easily install exa on your Linux machine from the official repository, and you just need to have a sudo privilege to perform the installation steps.

We have listed out the installation command for all major Linux distributions, so please do copy-paste the respective command into your Linux system:

Install exa on Ubuntu/Debian

sudo apt install exa                                            [Ubuntu/Debian Based distributions]

Install exa on Fedora/RockyLinux and RHEL

sudo dnf install exa                                            [Fedora/RockyLinux, and RHEL Based distributions]

Install exa on ManjaroLinux/EndeavourOS and Arch

sudo pacman -S exa                                           [ManjaroLinux/EndeavourOS Arch Based distributions]

Install exa on openSUSE

sudo zypper install exa                                     [openSUSE users]

If you are interested in having an exa binary file, you can directly download it from the Github release.

Basic Usage of exa command

The basic syntax of exa command is simple. You just need to invoke exa, and it will list out all the available files from the current directory.

$ exa [OPTIONS] [FILES]
Basic exa command output
Basic exa command output

And if you want to change the default output to something more meaningful rather than just A plain file, then you can use [OPTIONS] like -l, -i,-h.

Long List out files in exa

When we long list files with the ls -l command, you may find the output apathetic and unpleasant compared to exa output:

$ exa -l
  // OR
$ exa --long

I have attached both the outputs side by side to show you the difference. While reading the output, I found the permission character is color full, and it just prints the size of the file, not the directories.

In addition, it prints only the user, creation time, and file name, no other extra information compared to the ls -l command output.

You can also use -h or --header options to add a header on a listing

$ exa --long --header
  // OR
$ exa -lh
exa-with-header
exa command output with header

List out files in the human-readable format in exa

When I was a rookie, I was not able to get the size of the file very quickly. I was converting size into GB in my mind unless I found I could use the -h parameter to convert size into human-readable format.

Thanks to the exa command, you do not need to use -h format to list out files in human-readable format because it’s already available in a human-readable format like the below image:

exa -l /etc/
exa -l command output
List out files in the human-readable format in exa

List out files with icons in exa

As you know, pictures speak louder than words; similarly, the exa command can show the icon of the respective file, which can help you distinguish files very quickly.

exa command uses special Unicode symbols to display icons next to file names.

To enable icons with exa, pass the following command:

$ exa --icons
exa icons
exa icons

If you are not able to get the icon properly? Please follow the FAQ guide.

List out files in a tree structure

exa command is capable of listing out files in a tree structure that is similar to a Unix tree. To list out files in the tree structure, run the following command:

If you want to create a tree structure of the current directory, then use --tree and omit the file’s path.

$ exa --tree

When you want to restrict files to search to a specific level recursively, then specify --level count:

$ exa --tree --level=5
  // OR
$ exa --tree --level=5  abc 
exa with tree level
exa with tree level

You can use -l or -- long to list metadata information with the tree.

List out files with Git Status

We always run git status to check staged, unstaged entries to find new changes, but from now onwards, you do not need to do because the exa command can list out the staged and unstaged files in a separate column with -M(Modified) or -N (New).

Personally, I was not able to use the git feature in version 0.9.0. If the same thing happens to you, then use version 0.10.1.

To enable Git with exa use option --git:

$ exa --long --git
// or
$ exa -l --git
exa command with git
exa command with git

Wrap up

That’s all for now!

There are many options that you can use with exa to optimize your work, and I didn’t like one option of exa compared to ls -i when you just run exa -i to print the inode number, then it will not print the output unless you specify exa -il.

Maybe you find exa -il appropriate to use, but for me, the ls -i command is better for this specific task.

Yes, we can use the exa command as an alternative to the ls command for daily use. If you are into scripting, then please avoid it for now.

If you are interested in learning more about the exa tool, please refer to the manual by running man exa

Very soon, we will come up with another alternative tool.

What’s your opinion on exa command? Should we use the exa command over ls?

This Post Has One Comment

  1. Joe Bormel

    Instructions to install exa dont work for Linux Mint 20.3 (2022-04-19). Specifically sudo apt install exa produces “Unable to locate package exa”

    Multiple Google searches and project page for exa were non-productive of a solution. Manual instructions including installing Rust, using git and ‘sudo make install’ in the appropriate directory of exa failed. There was no ‘install’ file.

    Snap, which worked for ripgrep did not have exa.

Leave a Reply