eza

From RaySoft

eza is a modern, maintained replacement for the venerable file-listing command-line program ls that ships with Unix and Linux operating systems, giving it more features and better defaults. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s small, fast, and just one single binary. [1]

Documentation

Syntax

eza [PARAMETER ...] [FILE/DIRECTORY ...]

Parameters

Display

-1, --oneline
Display one entry per line.
--color=WHEN, --colour=WHEN
WHEN to use terminal colours.
Valid settings are always, automatic (or auto for short), and never. The default value is automatic
-F WHEN, --classify=WHEN
Display file kind indicators next to file names.
Valid settings are always, automatic (or auto for short), and never. The default value is automatic.
-l, --long
Display extended file metadata as a table.
-R, --recurse
Recurse into directories.
-T, --tree
Recurse into directories as a tree.

Filtering & Sorting

-a, --all
Show hidden and dot files. Use this twice to also show the . and .. directories.
--git-ignore
Do not list files that are ignored by Git.
-r, --reverse
Reverse the sort order.
-s FIELD, --sort=FIELD
Which FIELD to sort by.
Valid sort FIELDs are name, Name, extension, Extension, size, modified, changed, accessed, created, inode, type and none.
The modified sort field has the aliases date, time, and newest, and its reverse order has the aliases age and oldest.

Long View

These options are available when running with -l, --long:

-g, --group
List each file’s group.
--git
List each file’s Git status, if tracked.
This adds a two-character column indicating the staged and unstaged statuses respectively. The status character can be - for not modified, M for a modified file, N for a new file, D for deleted, R for renamed, T for type-change, I for ignored, and U for conflicted.
-h, --header
Add a header row to each column.
--time-style=STYLE
How to format timestamps.
Valid timestamp STYLEs are default, iso, long-iso, full-iso, relative, or a custom style +<FORMAT> (e.g. +%Y-%m-%d %H:%M => 2023-09-30 13:00).

Examples

Define aliases for directory listing
if type -P 'eza' >'/dev/null' 2>&1; then              # eza
  alias ls="eza --classify --time-style='long-iso'"
  alias ll='ls --git --group --header --long'
  alias l='ll --all --all'
else
  if ls --context >'/dev/null' 2>&1; then             # GNU ls version
    alias ls="ls --classify --color --time-style='long-iso'"

    if type -P 'dircolors' >'/dev/null' 2>&1; then
      eval "$(dircolors -b)"
    fi
  else                                                # other ls versions
    alias ls="ls -D '%F %T' -F -G"
  fi

  alias ll='ls -h -l'
  alias l='ll -a'
fi

alias lr='l -R'
alias lt="l -r -s 'time'"

References

  1. Repository contributors. "eza." GitHub. https://github.com/eza-community/eza (accessed 03.04.2024)