<!--
  canonical-url: https://www.avonture.be/blog/linux-eza
  published:     2024-07-23
  This is a static plain-Markdown mirror generated at build time.
  Visit the canonical URL above for the fully rendered page, with images and interactive components.
-->

# Let's revisit the ls command thanks to eza

> Tired of typing ls -alh? Discover eza, the modern, feature-rich replacement for the basic Linux ls command. Learn how to install it and set up a powerful new alias for a better command-line experience.

---
![Let's revisit the ls command thanks to eza](/img/v2/linux_tips.webp)

**TL;DR**

This article introduces `eza`, a modern replacement for the `ls` command (formerly known as `exa`), offering better defaults, icons, and formatting. It shows how to install it with `apt-get` and set up an alias with a useful combination of flags (`--all --long --group --group-directories-first --icons --header --time-style long-iso`) so `ls` automatically uses `eza` with a richer file listing.

Which CLI command would you say you use most on Linux? Most definitely `ls` to display the list of files in the current directory.

> **I don't know about you, but I rarely use `ls` without any parameters. Almost without thinking, I add `-alh` every time. It's become mechanical.:**

And then you'll say to me, well, all you have to do is create an alias `alias ls="ls -alh"`; of course, but let's go further and revisit this basic command and add some functionality to it.

`eza` is a modern replacement for `ls` as stated on their website: <https://eza.rocks/>.

*It belongs to the same family of "modern rewrites of the classics" as [ripgrep](/blog/ripgrep) (for `grep`) and [delta](/blog/git-delta) (for `git diff`). While you're customizing your console, [Customize your Linux prompt with Powerlevel10k](/blog/powerlevel10k_sandbox) is worth ten minutes too.*

> **eza was first called exa:**
>
> <https://github.com/ogham/exa> is abandoned; see [this issue](https://github.com/ogham/exa/issues/1243).
>
> **exa is now eza**: <https://eza.rocks/>

## Result

Once `ls` is aliased to `eza` with a few flags, this is what a plain `ls` looks like:

![eza](./images/eza.webp)

## Seeing It in Action with Docker

Before touching your `~/.bashrc`, try the alias in a throwaway container with a small, varied
folder already set up — a hidden file, a sub-folder or two, files of different sizes — so the
listing actually has something to show off.

> **Why Docker first?:**
>
> The Dockerfile below installs `eza`, sets up the exact `ls` alias from this article, and builds a
> demo folder for you. Nothing changes on your own machine.

**Dockerfile**

```docker
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        curl \
        ca-certificates && \
    rm -rf /var/lib/apt/lists/*

# Install eza from a prebuilt release (avoids adding eza's own apt repository
# just for a demo). Pin the version so this image keeps building the same
# way; bump it during a /freshness pass.
RUN curl -fsSL \
    https://github.com/eza-community/eza/releases/download/v0.23.5/eza_x86_64-unknown-linux-gnu.tar.gz \
    | tar -xz -C /usr/local/bin

# Recreate the exact alias from the article
RUN echo "alias ls='eza --all --long --group --group-directories-first --icons --header --time-style long-iso'" \
    >> /root/.bashrc

# Build a small, varied playground so the listing actually looks interesting:
# sub-folders, a dotfile, a text file and a binary-ish file of a different size
RUN mkdir -p /root/demo/src /root/demo/docs && \
    touch /root/demo/.env && \
    echo "# Notes" > /root/demo/README.md && \
    printf 'console.log("hi")\n' > /root/demo/src/index.js && \
    dd if=/dev/zero of=/root/demo/docs/report.pdf bs=1024 count=200 status=none

WORKDIR /root/demo

# Signal clearly that this shell runs inside a container
RUN echo "PS1='\n\e[0;33m🐳 \e[0;36m\$(whoami)\e[0m \w # '" >> /root/.bashrc

CMD ["/bin/bash", "-i"]
```

Build and run it:

```bash
$ docker build -t eza-demo .
[+] Building 14.2s (7/7) FINISHED
✔ exporting to image
$ docker run --rm -it eza-demo
🐳 root ~/demo # ls
Permissions Size User Date Modified Name
drwxr-xr-x     - root 2026-08-22    docs
drwxr-xr-x     - root 2026-08-22    src
.rw-r--r--    0 root 2026-08-22    .env
.rw-r--r--    8 root 2026-08-22    README.md
```

That's `ls` — really `eza` under the hood, thanks to the alias baked into the image. Icons,
grouped folders first, human-readable dates: the same result as the screenshot above, without
having installed anything on your own machine yet.

## Install eza

The installation is simple, you just need to run `sudo apt-get update && sudo apt-get install eza`; nothing more.

From now, simply run `eza` on the command line and you'll get the list of files with all the defaults presets.

On my computer, I've chosen for this list of parameters: `--all --long --group --group-directories-first --icons --header --time-style long-iso` and, for sure, I've updated my `~/.bashrc` file by adding an alias (if you're on ZSH, [give that alias its own file](/blog/modular-zsh-workflow) rather than growing a monolithic `.zshrc`):

```bash
$ alias ls='eza --all --long --group --group-directories-first --icons --header --time-style long-iso'
```

And, now, by just typing `ls`, you'll get the listing shown above.
