What it is
eza is a modern replacement for the standard ls command, offering enhanced features like Git integration, syntax highlighting, and tree views.
Installation
Linux (using package managers):
# Debian/Ubuntu
sudo apt update && sudo apt install eza
# Fedora
sudo dnf install eza
# Arch Linux
sudo pacman -S eza
Linux (using Cargo):
cargo install eza
Mac (using Homebrew):
brew install eza
Windows (using Scoop):
scoop install eza
Windows (using Cargo):
cargo install eza
Commands / Usage
Listing Files and Directories
-
List files and directories in the current directory:
ezaLists files and directories with default formatting.
-
List all files, including hidden ones:
eza -aShows all entries, including those starting with a dot (
.). -
List files with details (permissions, size, owner, date):
eza -lProvides a long listing format.
-
List files with human-readable file sizes:
eza -lhDisplays sizes in KB, MB, GB, etc.
-
List files recursively (show subdirectories):
eza -RLists contents of subdirectories as well.
-
List files in a tree-like format:
eza --treeDisplays directory structure in a visual tree.
-
List files sorted by modification time (newest first):
eza -ltSorts output by time.
-
List files sorted by size (largest first):
eza -lSSorts output by file size.
-
List files sorted by extension:
eza -lXSorts output alphabetically by file extension.
-
List files with Git status:
eza -lgShows Git status for files in a Git repository.
-
List files with Git status and highlight unread files:
eza -lghCombines Git status with highlighting for new/modified files.
-
List files with specific color themes:
eza --color=alwaysForces color output, useful for piping.
eza --color=autoEnables color output when outputting to a terminal.
eza --color=neverDisables color output.
-
List files with icons:
eza -GDisplays icons next to files and directories (requires a Nerd Font).
Filtering and Searching
-
List only directories:
eza -dShows only directories.
-
List only files:
eza -fShows only files.
-
List files matching a pattern:
eza "*.txt"Lists all files ending with
.txt. -
List files larger than a specific size:
eza -l --size +1MLists files larger than 1 megabyte.
-
List files modified within a specific time frame:
eza -l --time-days 7Lists files modified in the last 7 days.
Display Options
-
Show file permissions as octal:
eza -loDisplays permissions in numeric (octal) format.
-
Show file permissions as symbolic links:
eza -l --linksDisplays symbolic links with their target.
-
Show file owner and group:
eza -lugDisplays the user and group owner of files.
-
Show file inode number:
eza -liDisplays the inode number for each file.
-
Display file type indicators:
eza -FAppends symbols to indicate file types (e.g.,
/for directories,*for executables). -
Control displayed columns:
eza -l --columns 3Displays output in 3 columns.
-
Hide specific file types:
eza -a --ignore-glob="*.log"Lists all files except those ending with
.log.
Aliases and Configuration
- Create an alias for common
ezausage: Add this to your shell’s configuration file (e.g.,~/.bashrc,~/.zshrc):
This allows you to usealias ls='eza --icons' alias ll='eza -l --icons' alias la='eza -la --icons' alias lt='eza --tree --icons'ls,ll, etc., witheza’s features.
Common Patterns
-
Get a detailed, human-readable, and iconized listing of all files in the current directory:
eza -lahGThis is a very common and informative way to view directory contents.
-
See the Git status of your project’s files:
eza -lgQuickly identify modified, added, or untracked files in a Git repository.
-
Find the largest files in a directory:
eza -lSh | headLists files by size (largest first) and shows the top 10.
-
View a directory’s structure in a tree format with icons:
eza --tree -GGreat for understanding nested directories.
-
Pipe
ezaoutput to other commands:eza -l | grep "myfile"Find a specific file within a detailed listing.
eza -a | wc -lCount the total number of files and directories (including hidden ones).
Gotchas
- Nerd Fonts Required for Icons: The
-G(or--icons) flag relies on Nerd Fonts being installed and your terminal emulator configured to use them. If you don’t see icons, this is likely the reason. - Default
lsBehavior: If you aliaslstoeza, be aware that some scripts might explicitly call the originallscommand and expect its exact output format. - Git Integration Requires Git: The Git-related flags (
-g,--git) only work within a Git repository and require Git to be installed. - Color Output with Pipes: When piping
eza’s output to another command, colors might be included by default, which can sometimes interfere with parsing. Use--color=neveror--color=auto(if the receiving command handles it) to manage this. --time-daysvs.--time-seconds: Be mindful of the time units when filtering by time.--time-daysis relative to the current day, while--time-secondsis a strict timestamp comparison.