Skip to content

exa Cheatsheet

exa Cheatsheet

Installation

PlatformCommand
Ubuntu 20.10+sudo apt update && sudo apt install exa
Debian/Ubuntu (older)cargo install exa
Arch Linuxsudo pacman -S exa
Fedorasudo dnf install exa
RHEL/CentOSsudo dnf install epel-release && sudo dnf install exa
openSUSEsudo zypper install exa
macOS (Homebrew)brew install exa
macOS (MacPorts)sudo port install exa
Windows (Scoop)scoop install exa
Universal (Cargo)cargo install exa

Verify Installation:

exa --version

Basic Commands

CommandDescription
exaList files in current directory (replaces ls)
exa -lLong format with permissions, size, and timestamps
exa -aShow all files including hidden (. files)
exa -laLong format with all files including hidden
exa -lhLong format with human-readable sizes (KiB, MiB, GiB)
exa -lHLong format with decimal sizes (KB, MB, GB)
exa -1One file per line (useful for scripting)
exa -RRecursive listing of directories
exa -FAdd file type indicators (/, @, |, =, >)
exa --gridGrid layout (default terminal view)
exa --acrossHorizontal flow layout
exa -DList only directories
exa -fList only files (exclude directories)
exa --color=alwaysForce color output
exa --color=neverDisable color output

Advanced Usage

CommandDescription
exa --treeDisplay directory structure as tree (replaces tree)
exa --tree --level=2Tree view limited to 2 levels deep
exa -l --gitShow Git status for files (tracked, modified, untracked)
exa --git-ignoreRespect .gitignore and show only tracked files
exa -l --sort=modifiedSort by modification time (newest first)
exa -l --sort=sizeSort by file size (largest first)
exa -l --sort=extensionSort by file extension
exa -l --reverseReverse sort order
exa -l --iconsDisplay file type icons (requires Nerd Fonts)
exa -l --extendedShow extended attributes (SELinux, ACLs)
exa -l@Short form for extended attributes
exa -liShow inode numbers
exa -lsShow block sizes
exa -l --octal-permissionsDisplay permissions in octal format (755)
exa -l --numericShow numeric user/group IDs instead of names
exa -l --time-style=isoISO format timestamps
exa -l --time-style=relativeRelative time (e.g., “2 hours ago”)
exa -l --modifiedShow modification time (default)
exa -l --accessedShow last access time
exa -l --createdShow creation time
exa --ignore-glob="*.tmp"Ignore files matching pattern
exa -lZShow SELinux security context
exa --tree --git --iconsTree view with Git status and icons
exa -R --level=3Recursive listing limited to 3 levels

Configuration

Shell Aliases

Add these to your ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish:

# Basic replacements
alias ls='exa'
alias l='exa -l'
alias la='exa -la'
alias ll='exa -l'
alias lt='exa --tree'

# Advanced aliases
alias lg='exa -l --git'
alias lgi='exa -l --git --git-ignore'
alias lt2='exa --tree --level=2'
alias lta='exa -la --tree'

# Comprehensive view
alias lx='exa -lah --git --icons --group --time-style=long-iso'

# Sorting shortcuts
alias lm='exa -l --sort=modified --reverse'  # Most recent first
alias lz='exa -l --sort=size --reverse'      # Largest first

# Tree with Git
alias ltg='exa --tree --git --level=3'

Color Customization

Set custom colors using the EXA_COLORS environment variable:

# Add to ~/.bashrc or ~/.zshrc
export EXA_COLORS="da=38;5;245:sb=38;5;204:sn=38;5;43:uu=38;5;245:un=38;5;241"

# Color codes:
# da = date
# sb = file size
# sn = size number
# uu = user (you)
# un = user (other)
# gu = group (you)
# gn = group (other)

Default Options

Create a function wrapper for default options:

# Add to shell configuration
exa() {
    command exa --icons --group-directories-first "$@"
}

Common Use Cases

Use Case: Inspecting Git Repository

# Show all files with Git status and icons
exa -la --git --icons

# Tree view of repository with Git status (ignore node_modules)
exa --tree --git --ignore-glob="node_modules|.git" --level=3

# Only show modified files
exa -l --git | grep -E "M|A|D"

Use Case: Finding Large Files

# List files by size, largest first
exa -l --sort=size --reverse

# Recursive search for large files with human-readable sizes
exa -lRh --sort=size --reverse | head -20

# Show only files (no directories) sorted by size
exa -lf --sort=size --reverse

Use Case: Auditing File Permissions

# Show permissions in octal format with extended attributes
exa -l@ --octal-permissions

# Show all permission details with numeric IDs
exa -la --numeric --octal-permissions

# Check SELinux contexts
exa -lZ /var/www/html

Use Case: Analyzing Directory Structure

# Tree view with file sizes and modification times
exa -l --tree --level=3 --time-style=iso

# Show directory structure with Git awareness
exa --tree --git --icons --level=4 --ignore-glob=".git"

# List only directories in tree format
exa -D --tree --level=2

Use Case: Quick File Browsing

# Grid view with icons for visual scanning
exa --icons --grid

# Long format with all metadata
exa -lah --icons --git --time-style=relative

# Show recent changes (last 24 hours)
exa -l --sort=modified --reverse --time-style=relative | head -20

Best Practices

  • Use aliases: Set up shell aliases to replace ls with exa for consistent experience across your workflow
  • Install Nerd Fonts: For full icon support, install a Nerd Font (e.g., FiraCode Nerd Font, Hack Nerd Font) in your terminal
  • Combine with Git: Always use --git flag in repositories to see file status at a glance without running git status
  • Leverage tree view: Use exa --tree instead of installing separate tree command, especially with --level to control depth
  • Configure colors: Customize EXA_COLORS to match your terminal theme for better readability
  • Use time-style options: Choose --time-style=relative for recent files or --time-style=iso for precise timestamps
  • Script-friendly output: Use -1 (one per line) and --color=never when piping to other commands or scripts
  • Respect gitignore: In large repositories, use --git-ignore to avoid listing thousands of build artifacts or dependencies
  • Combine sorting options: Chain --sort with --reverse to get exactly the order you need (newest, largest, etc.)
  • Performance in large directories: For directories with thousands of files, basic exa is faster than exa -l --git --icons

Troubleshooting

IssueSolution
Icons not displaying correctlyInstall a Nerd Font and configure your terminal to use it. Download from nerdfonts.com
exa: command not foundEnsure installation completed successfully. Check $PATH includes /usr/local/bin or ~/.cargo/bin
Git status not showingVerify you’re in a Git repository (git status). Use exa -l --git explicitly
Colors not working in pipesUse exa --color=always when piping to less or other commands: exa --color=always | less -R
Slow performance on network drivesDisable Git integration (--no-git) and avoid extended attributes (--no-extended) on slow filesystems
Permission denied errorsSome extended attributes require elevated privileges. Use sudo exa -l@ or skip with regular exa -l
Tree view truncatedIncrease depth with --level=N or remove limit with no level flag (caution: may be slow on large trees)
Alias conflicts with system lsUse \ls to call original ls, or unalias ls temporarily. Check aliases with alias | grep ls
Icons showing as boxes/squaresTerminal doesn’t support Unicode properly. Update terminal emulator or disable icons with --no-icons
Different output than lsexa sorts and displays differently by default. Use --sort=name and adjust flags to match ls behavior

Quick Reference: Time Options

FlagDescriptionExample Output
--modified or -mModification time (default)2024-01-15 14:30
--accessed or -uLast access time2024-01-15 09:15
--created or -UCreation time2024-01-10 08:00
--time-style=isoISO format2024-01-15 14:30
--time-style=long-isoLong ISO format2024-01-15 14:30:45
--time-style=full-isoFull ISO with timezone2024-01-15 14:30:45.123456789 +0000
--time-style=relativeRelative time2 hours ago

Quick Reference: Sort Options

Sort KeyDescriptionUsage
nameAlphabetical by name (default)exa -l --sort=name
sizeFile sizeexa -l --sort=size
extensionFile extensionexa -l --sort=extension
modifiedModification timeexa -l --sort=modified
accessedAccess timeexa -l --sort=accessed
createdCreation timeexa -l --sort=created
typeFile type (dir, file, link)exa -l --sort=type
inodeInode numberexa -l --sort=inode
oldestOldest first (reverse modified)exa -l --sort=oldest

Add --reverse to any sort to invert the order.