If you use a Linux and Unix-like operating system, you will definitely be familiar with or used the
ls command-line utility. It lists information about files or directories. Being decades-old command, ls has not improved a lot to bring modern functionality that you may be wanting, for instance, Git support, colorful, and tree view output. Here’s where
exa tool comes as the modern ls alternative.
Exa: ‘ls’ Alternative Listing Command Written In Rust
Similar to ls, exa is also a free and open source command-line utility that lists files. However, exa is small, fast, and user-friendly with more features and better query performance.
If your day involves listing and interacting with hundreds of files, exa can help you reduce your lot of efforts by displaying output in a few seconds using the parallel query.
Not just a fast query, but it can be helpful in easily recognizing the file types and metadata, which is colored differently based on the file extensions by default.
As you can see in the above picture, exa also prints human-readable file sizes by default. While you need to use
--human-readable option for ls command.
Moreover, exa comes with a built-in tool for printing tree-view output that you can also combine with file information.
Find your dream job
And the most interesting feature that distinguishes exa from ls is the support for the Git version control system.
If you are inside your Git repository and want to see if any files changed or modified since the last commit without installing Git and using
git status, you can use –git option with exa. It adds a new Git column in the metadata table containing two characters that depict staged or unstaged status.
How To Install Exa On Ubuntu And Other Linux Distros?
Interestingly, exa is a standalone binary that doesn’t require any dependencies to be installed. The only thing you need to install it is to download a binary for your OS and place it in a directory (most probably /usr/bin/) listed in $PATH environment variable.
However, if you find this manual method difficult, another (easiest) way to install exa is using the default package manager of your system.
For Debian and Ubuntu 20.10+, you can run:
$ sudo apt install exa
$ pacman -S exa
$ dnf install exa
$ emerge sys-apps/exa
$ zypper install exa
$ dnf install exa
Furthermore, if you use macOS and already have a Homebrew package manager installed, run the following command:
$ brew install exa
At last, you can also compile and built it using the source code, required dependencies, and following the instruction given here.
How To Use Exa?
List Files With Meta Data
-l option, you can displays files along with their metadata.
$ exa -l
And if you don’t know what each column in metadata means, you can use the same option along with
-h that adds a new row defining each column.
$ exa -lh
Displays Content Of A Directory
Instead of the current directory, if you want to list the all content of a particular directory, you can directly pass the directory path as an argument.
$ exa <directory-path>
List Files In All Directories And Subdirectories
To list directories and subdirectories recursively, you can
-R option. It creates a separate listing for each sub-directory.
$ exa -R
List Content Of Directory In Tree-Like Format
Since exa has a built-in tool that displays content tree-like format recursively, you don’t need an extra command like a tree. You can just pass
-T option and it will list the content of all directory and sub-directory in a tree structure.
$ exa -T
If you want to view the content of subdirectory to a particular extent, you can also limit the depth of recursion using
$ exa -L 2
Disable Colorful Output
Not a fan of viewing colorful terminal output? Well, exa also accept
--color option with values always, automatic, and never. If you want to disable the color, pass
$ exa --long --color=never
If you want to get the most out of the exa utility, you can read its official documentation.
Do you think the time has come to replace ls with exa command or you’ve already done it? Do let us know in the comment below.