eza: beyond ls 2024-01-27

exa is a modern replacement for ‘ls’. It does what ‘ls’ does but with more style and info.

I’ve switched from using ls to eza for listing my files. In this post, I’d like to share how I use eza.

Setup

I downloaded a eza source archive from its GitHub repository and extracted it. I’ll be running the commands in this project.

$ curl -LO https://github.com/eza-community/eza/archive/refs/tags/v0.17.3.tar.gz
$ tar -xvf v0.17.3.tar.gz
$ cd eza-0.17.3/
$ ls
benches/  build.rs  Cargo.lock  Cargo.toml  CHANGELOG.md  cliff.toml  CODE_OF_CONDUCT.md  completions/  CONTRIBUTING.md  deb.asc  deny.toml  devtools/  docs/  flake.lock  flake.nix  INSTALL.md  Justfile  LICENCE  man/  powertest.yaml  README.md  rust-toolchain.toml  rustfmt.toml  SECURITY.md  snap/  src/  tests/  treefmt.nix

Options I Use

Here are some options that I find super helpful:

Display options:

  • -l, —long: display extended details and attributes
  • -T, —tree: recurse into directories as a tree

Filtering options:

  • -a, —all: show hidden and ‘dot’ files
  • -L, —level=(depth): limit the depth of recursion
  • —group-directories-first: list directories before other files
  • -D, —only-dirs: list only directories
  • -f, —only-files: list only files

Long view options:

  • -m, —modified: use the modified timestamp field
  • —git: list each file’s Git status, if tracked or ignored
  • —time-style: how to format timestamps

Note that you can see the full list of options by running eza --help.

Use Cases

Here’s what you see when you run eza with no options:

$ eza
benches  build.rs  Cargo.lock  Cargo.toml  CHANGELOG.md  cliff.toml  CODE_OF_CONDUCT.md  completions  CONTRIBUTING.md  deb.asc  deny.toml  devtools  docs  flake.lock  flake.nix  INSTALL.md  Justfile  LICENCE  man  powertest.yaml  README.md  rust-toolchain.toml  rustfmt.toml  SECURITY.md  snap  src  tests  treefmt.nix

If you want to see only directories (folders):

$ eza --all --only-dirs
.github  benches  completions  devtools  docs  man  snap  src  tests

and only files

$ eza --all --only-files
.envrc  .git-blame-ignore-revs  .gitignore  build.rs  Cargo.lock  Cargo.toml  CHANGELOG.md  cliff.toml  CODE_OF_CONDUCT.md  CONTRIBUTING.md  deb.asc  deny.toml  flake.lock  flake.nix  INSTALL.md  Justfile  LICENCE  powertest.yaml  README.md  rust-toolchain.toml  rustfmt.toml  SECURITY.md  treefmt.nix

For a detailed view:

$ eza --long --modified --git --time-style=iso --group-directories-first
drwxr-xr-x@    - jungmin 01-25 06:07 benches
drwxr-xr-x@    - jungmin 01-25 06:07 completions
drwxr-xr-x@    - jungmin 01-25 06:07 devtools
drwxr-xr-x@    - jungmin 01-25 06:07 docs
drwxr-xr-x@    - jungmin 01-25 06:07 man
drwxr-xr-x@    - jungmin 01-25 06:07 snap
drwxr-xr-x@    - jungmin 01-25 06:07 src
drwxr-xr-x@    - jungmin 01-25 06:07 tests
.rw-r--r--@ 3.9k jungmin 01-25 06:07 build.rs
.rw-r--r--@  43k jungmin 01-25 06:07 Cargo.lock
.rw-r--r--@ 3.2k jungmin 01-25 06:07 Cargo.toml
.rw-r--r--@  32k jungmin 01-25 06:07 CHANGELOG.md
.rw-r--r--@ 2.5k jungmin 01-25 06:07 cliff.toml
.rw-r--r--@ 5.5k jungmin 01-25 06:07 CODE_OF_CONDUCT.md
.rw-r--r--@ 8.1k jungmin 01-25 06:07 CONTRIBUTING.md
.rw-r--r--@ 1.7k jungmin 01-25 06:07 deb.asc
.rw-r--r--@  12k jungmin 01-25 06:07 deny.toml
.rw-r--r--@ 8.1k jungmin 01-25 06:07 flake.lock
.rw-r--r--@ 9.3k jungmin 01-25 06:07 flake.nix
.rw-r--r--@ 6.2k jungmin 01-25 06:07 INSTALL.md
.rw-r--r--@ 7.2k jungmin 01-25 06:07 Justfile
.rw-r--r--@ 1.1k jungmin 01-25 06:07 LICENCE
.rw-r--r--@ 2.6k jungmin 01-25 06:07 powertest.yaml
.rw-r--r--@ 7.9k jungmin 01-25 06:07 README.md
.rw-r--r--@  146 jungmin 01-25 06:07 rust-toolchain.toml
.rw-r--r--@   34 jungmin 01-25 06:07 rustfmt.toml
.rw-r--r--@  505 jungmin 01-25 06:07 SECURITY.md
.rw-r--r--@  586 jungmin 01-25 06:07 treefmt.nix

To see how the --git option adds useful info:

$ git init
$ git add --all
$ eza --long --modified --git --time-style=iso --group-directories-first
drwxr-xr-x@    - jungmin 01-25 06:07 N- benches
drwxr-xr-x@    - jungmin 01-25 06:07 N- completions
drwxr-xr-x@    - jungmin 01-25 06:07 N- devtools
drwxr-xr-x@    - jungmin 01-25 06:07 N- docs
drwxr-xr-x@    - jungmin 01-25 06:07 N- man
drwxr-xr-x@    - jungmin 01-25 06:07 N- snap
drwxr-xr-x@    - jungmin 01-25 06:07 N- src
drwxr-xr-x@    - jungmin 01-25 06:07 N- tests
.rw-r--r--@ 3.9k jungmin 01-25 06:07 N- build.rs
.rw-r--r--@  43k jungmin 01-25 06:07 N- Cargo.lock
.rw-r--r--@ 3.2k jungmin 01-25 06:07 N- Cargo.toml
.rw-r--r--@  32k jungmin 01-25 06:07 N- CHANGELOG.md
.rw-r--r--@ 2.5k jungmin 01-25 06:07 N- cliff.toml
.rw-r--r--@ 5.5k jungmin 01-25 06:07 N- CODE_OF_CONDUCT.md
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- CONTRIBUTING.md
.rw-r--r--@ 1.7k jungmin 01-25 06:07 N- deb.asc
.rw-r--r--@  12k jungmin 01-25 06:07 N- deny.toml
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- flake.lock
.rw-r--r--@ 9.3k jungmin 01-25 06:07 N- flake.nix
.rw-r--r--@ 6.2k jungmin 01-25 06:07 N- INSTALL.md
.rw-r--r--@ 7.2k jungmin 01-25 06:07 N- Justfile
.rw-r--r--@ 1.1k jungmin 01-25 06:07 N- LICENCE
.rw-r--r--@ 2.6k jungmin 01-25 06:07 N- powertest.yaml
.rw-r--r--@ 7.9k jungmin 01-28 00:33 N- README.md
.rw-r--r--@  146 jungmin 01-25 06:07 N- rust-toolchain.toml
.rw-r--r--@   34 jungmin 01-25 06:07 N- rustfmt.toml
.rw-r--r--@  505 jungmin 01-25 06:07 N- SECURITY.md
.rw-r--r--@  586 jungmin 01-25 06:07 N- treefmt.nix
$ echo "hello!" >> README.md
$ touch hello
$ eza --long --modified --git --time-style=iso --group-directories-first
drwxr-xr-x@    - jungmin 01-25 06:07 N- benches
drwxr-xr-x@    - jungmin 01-25 06:07 N- completions
drwxr-xr-x@    - jungmin 01-25 06:07 N- devtools
drwxr-xr-x@    - jungmin 01-25 06:07 N- docs
drwxr-xr-x@    - jungmin 01-25 06:07 N- man
drwxr-xr-x@    - jungmin 01-25 06:07 N- snap
drwxr-xr-x@    - jungmin 01-25 06:07 N- src
drwxr-xr-x@    - jungmin 01-25 06:07 N- tests
.rw-r--r--@ 3.9k jungmin 01-25 06:07 N- build.rs
.rw-r--r--@  43k jungmin 01-25 06:07 N- Cargo.lock
.rw-r--r--@ 3.2k jungmin 01-25 06:07 N- Cargo.toml
.rw-r--r--@  32k jungmin 01-25 06:07 N- CHANGELOG.md
.rw-r--r--@ 2.5k jungmin 01-25 06:07 N- cliff.toml
.rw-r--r--@ 5.5k jungmin 01-25 06:07 N- CODE_OF_CONDUCT.md
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- CONTRIBUTING.md
.rw-r--r--@ 1.7k jungmin 01-25 06:07 N- deb.asc
.rw-r--r--@  12k jungmin 01-25 06:07 N- deny.toml
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- flake.lock
.rw-r--r--@ 9.3k jungmin 01-25 06:07 N- flake.nix
.rw-r--r--@    0 jungmin 01-28 00:35 -N hello
.rw-r--r--@ 6.2k jungmin 01-25 06:07 N- INSTALL.md
.rw-r--r--@ 7.2k jungmin 01-25 06:07 N- Justfile
.rw-r--r--@ 1.1k jungmin 01-25 06:07 N- LICENCE
.rw-r--r--@ 2.6k jungmin 01-25 06:07 N- powertest.yaml
.rw-r--r--@ 7.9k jungmin 01-28 00:35 NM README.md
.rw-r--r--@  146 jungmin 01-25 06:07 N- rust-toolchain.toml
.rw-r--r--@   34 jungmin 01-25 06:07 N- rustfmt.toml
.rw-r--r--@  505 jungmin 01-25 06:07 N- SECURITY.md
.rw-r--r--@  586 jungmin 01-25 06:07 N- treefmt.nix

Tree view, to see how your files are organized:

$ eza --tree --level=2
.
├── benches
│  └── my_benchmark.rs
├── build.rs
├── Cargo.lock
├── Cargo.toml
├── CHANGELOG.md
├── cliff.toml
├── CODE_OF_CONDUCT.md
├── completions
│  ├── bash
│  ├── fish
│  ├── nush
│  └── zsh
├── CONTRIBUTING.md
├── deb.asc
├── deny.toml
├── devtools
│  ├── deb-package.sh
│  ├── dir-generator.sh
│  ├── generate-timestamp-test-dir.sh
│  └── generate-trycmd-test.sh
├── docs
│  ├── images
│  └── tapes
├── flake.lock
├── flake.nix
├── INSTALL.md
├── Justfile
├── LICENCE
├── man
│  ├── eza.1.md
│  ├── eza_colors-explanation.5.md
│  └── eza_colors.5.md
├── powertest.yaml
├── README.md
├── rust-toolchain.toml
├── rustfmt.toml
├── SECURITY.md
├── snap
│  └── snapcraft.yaml
├── src
│  ├── fs
│  ├── info
│  ├── lib.rs
│  ├── logger.rs
│  ├── main.rs
│  ├── options
│  ├── output
│  └── theme
├── tests
│  ├── cli_tests.rs
│  ├── cmd
│  ├── gen
│  ├── itest
│  └── ptests
└── treefmt.nix

and the tree view with more details

$ eza --tree --level=2 --long --modified --git --time-style=iso --group-directories-first
drwxr-xr-x@    - jungmin 01-28 00:35 NN .
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── benches
.rw-r--r--@  369 jungmin 01-25 06:07 N- │  └── my_benchmark.rs
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── completions
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── bash
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── fish
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── nush
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  └── zsh
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── devtools
.rwxr-xr-x@ 5.6k jungmin 01-25 06:07 N- │  ├── deb-package.sh
.rw-r--r--@ 2.5k jungmin 01-25 06:07 N- │  ├── dir-generator.sh
.rw-r--r--@  616 jungmin 01-25 06:07 N- │  ├── generate-timestamp-test-dir.sh
.rwxr-xr-x@  861 jungmin 01-25 06:07 N- │  └── generate-trycmd-test.sh
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── docs
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── images
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  └── tapes
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── man
.rw-r--r--@  13k jungmin 01-25 06:07 N- │  ├── eza.1.md
.rw-r--r--@ 2.5k jungmin 01-25 06:07 N- │  ├── eza_colors-explanation.5.md
.rw-r--r--@ 7.4k jungmin 01-25 06:07 N- │  └── eza_colors.5.md
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── snap
.rw-r--r--@  837 jungmin 01-25 06:07 N- │  └── snapcraft.yaml
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── src
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── fs
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── info
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── options
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── output
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── theme
.rw-r--r--@  192 jungmin 01-25 06:07 N- │  ├── lib.rs
.rw-r--r--@ 1.7k jungmin 01-25 06:07 N- │  ├── logger.rs
.rw-r--r--@  17k jungmin 01-25 06:07 N- │  └── main.rs
drwxr-xr-x@    - jungmin 01-25 06:07 N- ├── tests
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── cmd
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── gen
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── itest
drwxr-xr-x@    - jungmin 01-25 06:07 N- │  ├── ptests
.rw-r--r--@  691 jungmin 01-25 06:07 N- │  └── cli_tests.rs
.rw-r--r--@ 3.9k jungmin 01-25 06:07 N- ├── build.rs
.rw-r--r--@  43k jungmin 01-25 06:07 N- ├── Cargo.lock
.rw-r--r--@ 3.2k jungmin 01-25 06:07 N- ├── Cargo.toml
.rw-r--r--@  32k jungmin 01-25 06:07 N- ├── CHANGELOG.md
.rw-r--r--@ 2.5k jungmin 01-25 06:07 N- ├── cliff.toml
.rw-r--r--@ 5.5k jungmin 01-25 06:07 N- ├── CODE_OF_CONDUCT.md
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- ├── CONTRIBUTING.md
.rw-r--r--@ 1.7k jungmin 01-25 06:07 N- ├── deb.asc
.rw-r--r--@  12k jungmin 01-25 06:07 N- ├── deny.toml
.rw-r--r--@ 8.1k jungmin 01-25 06:07 N- ├── flake.lock
.rw-r--r--@ 9.3k jungmin 01-25 06:07 N- ├── flake.nix
.rw-r--r--@    0 jungmin 01-28 00:35 -N ├── hello
.rw-r--r--@ 6.2k jungmin 01-25 06:07 N- ├── INSTALL.md
.rw-r--r--@ 7.2k jungmin 01-25 06:07 N- ├── Justfile
.rw-r--r--@ 1.1k jungmin 01-25 06:07 N- ├── LICENCE
.rw-r--r--@ 2.6k jungmin 01-25 06:07 N- ├── powertest.yaml
.rw-r--r--@ 7.9k jungmin 01-28 00:35 NM ├── README.md
.rw-r--r--@  146 jungmin 01-25 06:07 N- ├── rust-toolchain.toml
.rw-r--r--@   34 jungmin 01-25 06:07 N- ├── rustfmt.toml
.rw-r--r--@  505 jungmin 01-25 06:07 N- ├── SECURITY.md
.rw-r--r--@  586 jungmin 01-25 06:07 N- └── treefmt.nix

Making it Easy

I’ve made some shortcuts (aliases) in my setup to make using eza even faster.

In my config.fish (I use fish shell):

alias ls="eza --all"
alias ld="eza --all --only-dirs"
alias lf="eza --all --only-files"
alias ll="eza --long --modified --git --time-style=iso --group-directories-first"
alias lla="eza --long --modified --git --time-style=iso --group-directories-first --all"
alias tree="eza --tree --level=2"
alias treel="eza --tree --level=2 --long --modified --git --time-style=iso --group-directories-first"

Give these commands a try and see how they can help you!