Exa – A Modern Replacement for ls Command

exa is a tiny, fast, and modern replacement for the ordinary ls command that comes pre-installed on all Unix and Linux operating systems. It is an enhanced file lister that ships with more advanced features and a more user-friendly version of ls.

It uses colors to determine the information of file types and metadata. It is also aware of symlinks, extended attributes, viewing git status, and recursing into directories with a tree view.

The command exa is used by command-line users, system administrators, and programmers hundreds of times daily, as well as being helpful when writing automated scripts.

Installing exa on Linux Systems

exa is a self-contained binary package, which is available for many modern Linux distributions and can be installed using common package managers.

$ sudo apt install exa      [On Ubuntu & Debian]
$ sudo dnf install exa      [On Fedora, CentOS & RHEL]
$ sudo zypper install exa   [On openSUSE]
$ sudo emerge sys-apps/exa  [On Gentoo]
$ sudo pacman -S exa        [On Arch & Manjaro]

If you are using an earlier version of Linux distribution, you will have to use the manual installation procedure.

Using exa on Linux Systems

As mentioned earlier, exa is an improvement version of the classic ls command and can be executed by specifying your options, and input file names, then exa queries the filesystem and displays the names and information of metadata about the files it comes across.

$ exa [OPTIONS] [FILES]

exa doesn’t bother whether files or options come first in the list, though it’s common practice to put the options before the files.

Listing Files

Listing files is a cakewalk, you just need to mention the filename with an argument with some options for how to print files, and exa will list them.

$ exe 
$ exa -l
$ exa -l Linux_For_Beginners.pdf
Exa - Listing Files
Exa – Listing Files

Listing Directories

If you specify a directory name to exa, it will list the contents of that directory rather than listing the directory itself.

$ exa Documents
Exa - Directory Listing
Exa – Directory Listing

Listing Links

A link is a file that points to another file as its “actual” contents in Linux. When you run exa, it will print a link’s target path next to its filename as shown.

$ exa -l /etc/localtime /etc/resolv.conf
Exa Listing Links
Exa Listing Links

Recursive Listing

Finally, it’s achievable for exa to recurse into a directory and display the contents of every sub-directory underneath it.

$ exa -l --recurse /home
Exa Recursive Listing
Exa Recursive Listing

For a complete reference on what exa can do, visit the documentation pages here.

10 thoughts on “Exa – A Modern Replacement for ls Command”

  1. The error seems to have been created by the comment administration software. The sixth last line should have been:

    ls filename (with angle braces around ‘filename’)

    Instead, it came out as just:

    ls
    
    Reply
  2. There is an error in the 6th last non-blank line above. I have corrected it below:)

    For me, a useful improvement on ls would:

    1. retain ls’s ability to format the date in any designated way as can be accomplished with its --time-style=TIME_STYLE parameter.
    2. retain ls’s ability to show the file’s group ownership.
    3. allow any field to be excluded or included; and.
    4. allow the output fields to be placed in any designated order.

    exa accomplishes only the third in a very clumsy way with its boolean parameters --no-permissions, --no-filesize, --no-user, and --no-time parameters, but it doesn’t accomplish 1, 2 and 4.

    My workaround, which accomplishes, for me, 1, 3 and 4 is the bash script:

    #!/bin/bash
    if [ $1 ];then
      foundFile=$1
      ls -l --time-style=+%y%m%d%H%M $foundFile | awk '{print $6, $5, $7}'
    else
      ls -l --time-style=+%y%m%d%H%M | awk '{print $6, $5, $7}'
    fi
    

    The first branch is the logical equivalent of:

    ls 
    

    The second branch is the logical equivalent of just:

    ls
    

    An example of my script’s use is:

    $ lsi gridlinedBanner.xcf 
    2102030143 3718281 gridlinedBanner.xcf
    
    Reply
  3. For me, a useful improvement on ls command would:

    1. Retain ls’s ability to format the date in any designated way as can be accomplished with its --time-style=TIME_STYLE parameter.
    2. Retain ls’s ability to show the file’s group ownership.
    3. Allow any field to be excluded or included; and
    4. Allow the output fields to be placed in any designated order.

    exa accomplishes only the third in a very clumsy way with its boolean parameters --no-permissions, --no-filesize, --no-user and --no-time parameters, but it doesn’t accomplish 1, 2 and 4

    My workaround, which accomplishes, for me, 1, 3 and 4 is the bash script:

    #!/bin/bash
    if [ $1 ];then
      foundFile=$1
      ls -l --time-style=+%y%m%d%H%M $foundFile | awk '{print $6, $5, $7}'
    else
      ls -l --time-style=+%y%m%d%H%M | awk '{print $6, $5, $7}'
    fi
    

    The first branch is the logical equivalent of:

    $ ls 
    

    The second branch is the logical equivalent of just:

    $ ls
    

    An example of my script’s use is:

    $ lsi gridlinedBanner.xcf 
    2102030143 3718281 gridlinedBanner.xcf
    
    Reply
  4. It doesn’t seem to be able to do anything that ls can’t, either on its own or by means of simple combinations with other Unix tools.

    Reply
    • @Jay,

      No doubt that ls command does everything, but exa has some better features which are not present in ls, such as showing git status, colours to distinguish file types and metadata, built-in tree tool to list files in hierarchy pattern and many more. Also, exa is faster than ls, as it queries files in parallel.

      Reply
    • Ivan,

      It’s due to its fast execution as compared to the standard ls command, as it queries files in parallel, which makes exa faster and improves the performance of results. Also, it has some nicer features which are not present in ls such as viewing git status, colors to distinguish file types and metadata, a built-in tree tool to view files in hierarchy fashion and many more.

      Reply

Leave a Reply to Anusha Cancel reply