Scripts2026年4月11日·1 分钟阅读

eza — A Modern Colorful Replacement for ls

eza is a modern replacement for the venerable ls command. Adds colors, Git status, file type icons, tree view, and long-format improvements. Actively maintained fork of the archived exa project.

SC
Script Depot · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

# Install
brew install eza                          # macOS
sudo apt install eza                      # Debian/Ubuntu
cargo install eza                         # Rust
scoop install eza                         # Windows

# Replace ls in shell config
alias ls="eza"
alias ll="eza -lbhF --git"
alias la="eza -labhF --git"
alias lt="eza --tree --level=2"

Usage:

eza                    # Colorful ls
eza -l                 # Long format
eza -l --git           # Show git status
eza --tree             # Tree view
eza -T --level=3       # Tree with depth limit
eza --icons            # File type icons (needs Nerd Font)
eza -l --sort=modified # Sort by mtime
eza -l --group-directories-first
介绍

eza is a modern, maintained replacement for the venerable ls command. Fork of the archived exa project with active development and new features. Written in Rust with colors, Git status, file icons, tree view, and better long-format output. A quality-of-life upgrade every terminal user can appreciate.

What eza Does

  • Colors by file type — via LS_COLORS or custom scheme
  • Git status — show modified/added/ignored files
  • File icons — Nerd Font icons for file types
  • Tree view — recursive with depth control
  • Long format — human-readable sizes, permissions, modified time
  • Extended attrs — xattrs, ACLs, selinux
  • Sort options — name, size, mtime, accessed, created
  • Filters — only dirs, only files, hidden

Architecture

Single Rust binary, replaces ls. Reads filesystem + optional git repo state + file metadata. Parses LS_COLORS for theming. Uses Unicode width for correct alignment.

Self-Hosting

CLI tool.

Key Features

  • Drop-in ls replacement
  • Git integration
  • Nerd Font icons
  • Tree view
  • Color scheme support
  • Accurate Unicode width
  • Actively maintained (unlike archived exa)
  • Cross-platform

Comparison

Tool Git Icons Tree Maintained
eza Yes Yes Yes Yes
exa Yes Yes Yes Archived
lsd Yes Yes Yes Yes
ls (GNU) No No Partial Yes
tree No Partial Yes Yes

常见问题 FAQ

Q: eza vs lsd? A: 两者都不错。eza 更接近 ls 的用法和长格式输出;lsd 预设更花哨。看个人偏好。

Q: 图标乱码? A: 需要安装 Nerd Font(如 JetBrainsMono Nerd Font、FiraCode NF)并在终端里启用。

Q: 能完全替换 ls 吗? A: 90% 兼容,但不要替换系统脚本用的 ls(POSIX 要求)。用 shell alias 或 PATH 覆盖只影响交互式 shell。

来源与致谢 Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产