How to Use eza as a Modern Replacement for the ls Command on Ubuntu Linux

The ls command is one of the first things every Linux user learns. It lists the contents of a directory, and it has worked reliably for decades. However, its output has barely changed since the 1970s. File listings are displayed in plain monochrome text, file types are not visually distinguished, and the formatting makes it difficult to quickly scan a directory with hundreds of entries.

eza is a modern, open-source replacement for ls written in Rust. It produces colour-coded, icon-enhanced, human-readable file listings by default, with built-in support for Git status indicators, tree views, extended attributes, and intelligent column formatting. It is the actively maintained successor to the popular exa project (which is no longer updated).

Why Replace ls?

The default ls output has several practical limitations:

  • No colour by default in many contexts: While ls --color=auto adds basic colour coding, it must be explicitly enabled (or aliased), and the colours are often harsh and difficult to read on certain terminal backgrounds.
  • File sizes are in bytes: Seeing “4096” or “1048576” next to a file is not immediately useful. You need to add -h for human-readable sizes.
  • No Git integration: If you work in Git repositories, ls gives no indication of which files are modified, staged, untracked, or ignored.
  • No tree view: Viewing directory hierarchies requires the separate tree command. ls cannot show nested directory structures.
  • Timestamp formatting is inconsistent: Older files show the year but no time, while newer files show the time but no year.

eza addresses all of these issues out of the box.

How to Install eza on Ubuntu

eza is available in the default Ubuntu repositories from Ubuntu 24.04 onwards. For earlier versions, you can install it from the official eza repository.

Ubuntu 24.04 and Later

sudo apt update && sudo apt install eza

Ubuntu 22.04 and Earlier

Add the official eza GPG key and repository:

sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install eza

Once installed, run eza in any directory to see the immediate difference.

Basic Usage

eza is designed to be a drop-in replacement for ls. Most common ls flags work identically:

  • eza — List files in the current directory (equivalent to ls).
  • eza -l — Long format listing with permissions, owner, size, and date (equivalent to ls -l).
  • eza -la — Long format including hidden files (equivalent to ls -la).
  • eza -lh — Long format with human-readable file sizes. Note: eza uses binary units (KiB, MiB) by default, which are more technically accurate than the SI units used by ls -lh.

The key difference you will notice immediately is the colour scheme. eza uses a carefully designed palette where directories, executable files, symbolic links, images, videos, archives, and other file types each have distinct colours. This makes it trivially easy to scan a directory and identify file types at a glance.

The Tree View

One of eza’s best features is its built-in tree view. Instead of installing the separate tree command, you can use:

eza --tree

This displays the entire directory hierarchy with proper indentation and tree-drawing characters. You can limit the depth with:

eza --tree --level=2

This shows only two levels of nesting, which is useful for getting an overview of a project structure without being overwhelmed by deeply nested subdirectories.

The tree view also supports all other eza flags. For example, eza --tree -l shows a tree view with full file details (permissions, size, date) on every entry.

Git Integration

If you work with Git repositories, eza can display the Git status of every file and directory. Use the --git flag:

eza -l --git

This adds a column showing the Git status of each file:

  • N (New) — Untracked file.
  • M (Modified) — File has been modified since the last commit.
  • I (Ignored) — File is listed in .gitignore.
  • (Dash) — File is committed and unchanged.

This is incredibly useful when working in large repositories. Instead of running git status separately, you can see the status of every file directly in the file listing.

File Icons

eza supports file type icons using Nerd Fonts. If your terminal uses a Nerd Font (such as FiraCode Nerd Font, JetBrains Mono Nerd Font, or Hack Nerd Font), you can enable icons:

eza --icons

This displays a small icon next to each file based on its type: folder icons for directories, language-specific icons for source code files (Python, JavaScript, Rust, etc.), image icons for pictures, and so on. Combined with colour coding, this makes directory listings remarkably easy to parse visually.

Sorting Options

eza provides flexible sorting:

  • eza --sort=size — Sort by file size (largest first).
  • eza --sort=modified — Sort by modification time (most recent first).
  • eza --sort=name — Sort alphabetically (default).
  • eza --sort=extension — Sort by file extension, grouping similar file types together.
  • eza --sort=created — Sort by creation time.
  • eza --reverse — Reverse any sort order.

You can also group directories before files using --group-directories-first, which is a common preference that ls supports only with a GNU extension.

Filtering Files

eza includes built-in filtering that ls lacks:

  • eza --only-dirs — Show only directories.
  • eza --only-files — Show only files (no directories).
  • eza --git-ignore — Respect .gitignore rules and hide ignored files from the listing.

Setting eza as Your Default ls

Once you are comfortable with eza, you can alias it to replace ls globally. Add the following lines to your ~/.bashrc or ~/.zshrc file:

alias ls='eza --color=always --group-directories-first'
alias ll='eza -l --color=always --group-directories-first --icons'
alias la='eza -la --color=always --group-directories-first --icons'
alias lt='eza --tree --level=2 --color=always --group-directories-first --icons'

Reload your shell configuration:

source ~/.bashrc

Now, every time you type ls, ll, la, or lt, you get eza’s superior output instead of the traditional ls.

eza vs ls: Side-by-Side Comparison

Feature ls eza
Colour coding Basic (requires flag) Rich (default)
File icons No Yes (with Nerd Fonts)
Git status No Yes
Built-in tree view No Yes
Human-readable sizes Requires -h flag Default in long format
Consistent timestamps No (varies by age) Yes
Extended attributes Requires -@ flag Built-in with -@
Filter by type No Yes (–only-dirs, –only-files)
Performance Fast Fast (written in Rust)

eza is one of those terminal tools that, once installed, you wonder how you ever worked without it. The improved visual clarity alone saves time every single day, and features like Git integration and built-in tree views eliminate the need for several separate commands.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.