LinuxCommandLibrary

exa

List directory contents with improved formatting

TLDR

List files one per line

$ exa [[-1|--oneline]]
copy

List all files, including hidden files
$ exa [[-a|--all]]
copy

Long format list (permissions, ownership, size and modification date) of all files
$ exa [[-l|--long]] [[-a|--all]]
copy

List files with the largest at the top
$ exa [[-r|--reverse]] [[-s|--sort]] [size]
copy

Display a tree of files, three levels deep
$ exa [[-l|--long]] [[-T|--tree]] [[-L|--level]] [3]
copy

List files sorted by modification date (oldest first)
$ exa [[-l|--long]] [[-s|--sort]] [modified]
copy

List files with their headers, icons, and Git statuses
$ exa [[-l|--long]] [[-h|--header]] --icons --git
copy

Don't list files mentioned in .gitignore
$ exa --git-ignore
copy

SYNOPSIS

exa [OPTIONS] [FILES...]

Example: exa -lha --git --tree

PARAMETERS

-l, --long
    Displays detailed file information, including permissions, owner, size, and modification date.

-a, --all
    Shows all files, including hidden and dotfiles (. and ..).

-A, --almost-all
    Shows all files, including hidden files, but excludes . and ...

-T, --tree
    Lists contents of directories recursively in a hierarchical tree format.

-R, --recursive
    Lists contents of directories recursively.

--git
    Displays Git status for each file or directory within a Git repository.

--icons
    Displays icons for file types (requires a compatible icon font like Nerd Fonts).

--color=when
    Controls when to use colors: always, auto (default), or never.

-s sort_field, --sort=sort_field
    Sorts by a given field: name (default), size, modified, accessed, created, extension, inode, type, none.

-h, --header
    Displays a header row for the long listing format.

-L level, --level=level
    Limits the depth of the tree view when used with -T.

--group-directories-first
    Always lists directories before files, regardless of other sorting options.

--long-paths
    Displays full paths in the tree view instead of just filenames.

--octal-permissions
    Displays permissions in octal notation rather than symbolic.

DESCRIPTION

exa is a modern, feature-rich command-line file lister, designed as a more user-friendly and aesthetically pleasing alternative to the traditional ls command. Written in Rust, exa aims to provide better default behaviors, enhanced readability, and additional functionalities directly integrated into the listing process. Its key features include a vibrant, intelligent color scheme that highlights file types and permissions, human-readable file sizes by default, and optional Git status integration that displays the modification status of files within a repository.

Beyond basic file listing, exa offers a powerful recursive tree view (-T), allowing users to visualize directory structures. It can display extended file attributes, inode numbers, and provides flexible sorting options. For users with compatible icon fonts, exa can also render graphical icons alongside filenames, further improving visual parsing. Its default output is often more informative and easier to digest than ls's, making it a popular choice for daily command-line navigation and file management.

CAVEATS

While exa offers superior default formatting and features, it is not a 100% drop-in replacement for ls in all scripting scenarios. Its output format can differ, which might break scripts expecting ls's exact output. Additionally, icon display (--icons) requires specific icon fonts (e.g., Nerd Fonts) to be installed and configured on the terminal, otherwise, placeholders or missing characters may appear. For very large directories, especially with deep --tree views, resource consumption might be slightly higher than ls.

CONFIGURATION AND ALIASING

Many users alias ls to exa in their shell configuration files (e.g., .bashrc, .zshrc) to make exa the default listing command. A common alias is alias ls='exa -lF --git --icons' or alias l='exa -lF' to use exa with preferred options automatically.

PERFORMANCE

Written in Rust, exa is designed for speed and memory safety. While it offers more features and potentially more elaborate output than ls, its performance for typical directory listings is generally very fast and competitive.

HISTORY

The exa command was developed by Benjamin S. as a modern alternative to the venerable ls utility, written entirely in the Rust programming language. Its development began with a focus on improving the user experience of directory listing through better defaults, enhanced visual feedback via color and potentially icons, and integrating modern features like Git status awareness directly into the output. It quickly gained traction within the Unix/Linux community as part of a broader movement towards more user-friendly, feature-rich command-line tools written in newer, memory-safe languages.

SEE ALSO

ls(1), tree(1), find(1)

Copied to clipboard