exa Cheatsheet
Installation
| Platform | Command |
|---|
| Ubuntu 20.10+ | sudo apt update && sudo apt install exa |
| Debian/Ubuntu (older) | cargo install exa |
| Arch Linux | sudo pacman -S exa |
| Fedora | sudo dnf install exa |
| RHEL/CentOS | sudo dnf install epel-release && sudo dnf install exa |
| openSUSE | sudo 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
| Command | Description |
|---|
exa | List files in current directory (replaces ls) |
exa -l | Long format with permissions, size, and timestamps |
exa -a | Show all files including hidden (. files) |
exa -la | Long format with all files including hidden |
exa -lh | Long format with human-readable sizes (KiB, MiB, GiB) |
exa -lH | Long format with decimal sizes (KB, MB, GB) |
exa -1 | One file per line (useful for scripting) |
exa -R | Recursive listing of directories |
exa -F | Add file type indicators (/, @, |, =, >) |
exa --grid | Grid layout (default terminal view) |
exa --across | Horizontal flow layout |
exa -D | List only directories |
exa -f | List only files (exclude directories) |
exa --color=always | Force color output |
exa --color=never | Disable color output |
Advanced Usage
| Command | Description |
|---|
exa --tree | Display directory structure as tree (replaces tree) |
exa --tree --level=2 | Tree view limited to 2 levels deep |
exa -l --git | Show Git status for files (tracked, modified, untracked) |
exa --git-ignore | Respect .gitignore and show only tracked files |
exa -l --sort=modified | Sort by modification time (newest first) |
exa -l --sort=size | Sort by file size (largest first) |
exa -l --sort=extension | Sort by file extension |
exa -l --reverse | Reverse sort order |
exa -l --icons | Display file type icons (requires Nerd Fonts) |
exa -l --extended | Show extended attributes (SELinux, ACLs) |
exa -l@ | Short form for extended attributes |
exa -li | Show inode numbers |
exa -ls | Show block sizes |
exa -l --octal-permissions | Display permissions in octal format (755) |
exa -l --numeric | Show numeric user/group IDs instead of names |
exa -l --time-style=iso | ISO format timestamps |
exa -l --time-style=relative | Relative time (e.g., “2 hours ago”) |
exa -l --modified | Show modification time (default) |
exa -l --accessed | Show last access time |
exa -l --created | Show creation time |
exa --ignore-glob="*.tmp" | Ignore files matching pattern |
exa -lZ | Show SELinux security context |
exa --tree --git --icons | Tree view with Git status and icons |
exa -R --level=3 | Recursive 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
| Issue | Solution |
|---|
| Icons not displaying correctly | Install a Nerd Font and configure your terminal to use it. Download from nerdfonts.com |
exa: command not found | Ensure installation completed successfully. Check $PATH includes /usr/local/bin or ~/.cargo/bin |
| Git status not showing | Verify you’re in a Git repository (git status). Use exa -l --git explicitly |
| Colors not working in pipes | Use exa --color=always when piping to less or other commands: exa --color=always | less -R |
| Slow performance on network drives | Disable Git integration (--no-git) and avoid extended attributes (--no-extended) on slow filesystems |
| Permission denied errors | Some extended attributes require elevated privileges. Use sudo exa -l@ or skip with regular exa -l |
| Tree view truncated | Increase depth with --level=N or remove limit with no level flag (caution: may be slow on large trees) |
Alias conflicts with system ls | Use \ls to call original ls, or unalias ls temporarily. Check aliases with alias | grep ls |
| Icons showing as boxes/squares | Terminal doesn’t support Unicode properly. Update terminal emulator or disable icons with --no-icons |
Different output than ls | exa sorts and displays differently by default. Use --sort=name and adjust flags to match ls behavior |
Quick Reference: Time Options
| Flag | Description | Example Output |
|---|
--modified or -m | Modification time (default) | 2024-01-15 14:30 |
--accessed or -u | Last access time | 2024-01-15 09:15 |
--created or -U | Creation time | 2024-01-10 08:00 |
--time-style=iso | ISO format | 2024-01-15 14:30 |
--time-style=long-iso | Long ISO format | 2024-01-15 14:30:45 |
--time-style=full-iso | Full ISO with timezone | 2024-01-15 14:30:45.123456789 +0000 |
--time-style=relative | Relative time | 2 hours ago |
Quick Reference: Sort Options
| Sort Key | Description | Usage |
|---|
name | Alphabetical by name (default) | exa -l --sort=name |
size | File size | exa -l --sort=size |
extension | File extension | exa -l --sort=extension |
modified | Modification time | exa -l --sort=modified |
accessed | Access time | exa -l --sort=accessed |
created | Creation time | exa -l --sort=created |
type | File type (dir, file, link) | exa -l --sort=type |
inode | Inode number | exa -l --sort=inode |
oldest | Oldest first (reverse modified) | exa -l --sort=oldest |
Add --reverse to any sort to invert the order.