Skip to main content

Sysadmin tools: exa, a modern alternative to ls in Linux

Out with the old, in with the new! Explore an improvement on a classic Linux tool for listing files at your command line.
Image
sign for new skills training

Image by Pixabay

After my last article covering the ls command and its options, I was thinking about the shelf life of some commands and the improvements that you would have expected to see over the years. This kicked off a memory in my brain from All Things Open (ATO) 209 where IBM’s Chris Waldon hosted a talk on Terminal Velocity: Moving fast in your shell. If that title sounds familiar, it's because he wrote an article based on this talk. Anyway, during the ATO presentation, he featured a tool called exa that's a replacement for ls and I was pretty impressed with it. It turns out that some commands have been improved upon via well-executed, modern replacements. The exa utility is one of them.

So, what is exa? 

exa, as I mentioned earlier, is an improvement on the classic ls command. At its heart, it serves to display listing information for all files and directories in your current working directory. It doesn’t sound all that exciting, does it? There is, however, more on offer here than you might initially think. 

Image
ls vs exa

What improvements has exa made over ls? 

The design approach around exa is simple. More is better. If you browse the webpage, you’ll find that the creator put a lot of thought into why ls was so spartan. It makes a lot of sense. In the 1960s, computers were exponentially more limited by processing time for the input of commands and the output of results. The original command line suite of commands was built with this I/O bottleneck in mind. With today’s advancements in computing technology, most of us have supercomputers in our pockets that can handle these tasks with ease. So, of course, modern servers and desktops can handle whatever we throw at them in most circumstances.

exa runs the stat system call on every single file it encounters. It then takes the information gleaned from this call and color codes it by permission type, owner, size, and more. One of the first things you’ll notice when using exa is how colorful things are. If you're one of those weird people who prefer the drab black and white of a traditional terminal output, you can opt-out of the color usage if you want. For everyone out there who uses git repositories for change management, exa also displays the git status of files when applicable. As of this writing, only two git changes are currently tracked:

  • N - new file
  • M - an existing file

Installation and Aliasing

If these features look appealing to you, I recommend that you install exa and give it a try. Exa is packaged for a number of distributions. On Fedora, install the rust-exa package with sudo dnf install exaYou can also install in on Red Hat Enterprise Linux (RHEL), albeit manually, and it works on macOS as well. For detailed installation instructions, be sure to check out the official exa webpage

Once you have the program installed, you may want to alias it over your standard ls command. My alias looks something like this: 

Image
exa alias to ls

I encourage you to give it a try.  You might enjoy the tool and, if nothing else, it might get you thinking of other improvements that we need as sysadmins.

Want to try out Red Hat Enterprise Linux? Download it now for free.

Topics:   Linux  
Author’s photo

Tyler Carrigan

Tyler is the Sr. Community Manager at Enable Sysadmin, a submarine veteran, and an all-round tech enthusiast! He was first introduced to Red Hat in 2012 by way of a Red Hat Enterprise Linux-based combat system inside the USS Georgia Missile Control Center. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.