> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Install and Use exa on Linux
- URL: https://linuxhandbook.com/exa-command/
- Published: 2023-01-11T05:45:05.000Z
- Updated: 2023-01-11T05:45:05.000Z
- Description: Exa is a modern replacement to the classic ls command. Apart from git integration, it does several things by default ls cannot do.
- Author: Sagar Sharma
- Tags: Tools

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](https://linuxhandbook.com/content/images/2023/01/list-files-in-tree-manner-in-linux.png)

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](https://itsfoss.com/install-rust-cargo-ubuntu-linux/?ref=linuxhandbook.com) 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.](https://the.exa.website/install/source?ref=linuxhandbook.com) 

## 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](https://linuxhandbook.com/content/images/2023/01/exa-colors-on-linux.png)

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
```

![](https://linuxhandbook.com/content/images/2023/01/list-files-in-grid-view-on-linux.png)

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](https://linuxhandbook.com/content/images/2023/01/list-files-and-sort-them-respective-to-rows-in-linux.png)

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](https://linuxhandbook.com/content/images/2023/01/list-files-with-permissions-and-file-size-on-linux.png)

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](https://linuxhandbook.com/content/images/2023/01/enable-headers-and-user-group-column-on-exa.png)

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](https://linuxhandbook.com/content/images/2023/01/combine-long-and-grid-view-using-the-exa-command.png)

Pretty cool. Right?

### Tree display

exa can display the content like the [tree command](https://linuxhandbook.com/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](https://linuxhandbook.com/content/images/2023/01/list-files-in-tree-manner-in-linux.png)

### Sort files

To [sort files based on their size](https://linuxhandbook.com/sort-files-by-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](https://linuxhandbook.com/content/images/2023/01/sort-files-based-on-file-size-on-linux.png)

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 CommandsWhen 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![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2022/01/penguins.png)](https://itsfoss.com/legacy-linux-commands-alternatives/?ref=linuxhandbook.com)

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.