コンテンツにスキップ

exa チートシート

exa チートシート

インストール

プラットフォームコマンド
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
exa --version

基本コマンド

コマンド説明
exaList files in current directory (replaces ls)
exa -l権限、サイズ、タイムスタンプを含む長い形式
exa -aShow all files including hidden (. files)
exa -la隠しファイルを含むすべてのファイルの長い形式
exa -lh人間が読みやすいサイズ形式 (KiB, MiB, GiB)
exa -lH小数点サイズの長い形式 (KB, MB, GB)
exa -11行に1ファイル(スクリプティングに便利)
exa -Rディレクトリの再帰的リスト
exa -Fファイルタイプインジケータ(/、@、\)を追加
exa --gridグリッドレイアウト(デフォルトのターミナルビュー)
exa --across水平フロー レイアウト
exa -Dディレクトリのみをリストする
exa -fディレクトリを除外してファイルのみをリストする
exa --color=alwaysカラー出力を強制
exa --color=neverカラー出力を無効にする

高度な使用法

コマンド説明
exa --treeDisplay directory structure as tree (replaces tree)
exa --tree --level=2ツリービューを2レベルの深さに制限
exa -l --gitファイルのGitステータスを表示(追跡済み、変更済み、未追跡)
exa --git-ignoreRespect .gitignore and show only tracked files
exa -l --sort=modified更新時間で並べ替え(新しい順)
exa -l --sort=sizeファイルサイズで並べ替え(最大から)
exa -l --sort=extensionファイル拡張子で並べ替え
exa -l --reverse逆順に並べ替え
exa -l --iconsファイルタイプアイコンを表示 (Nerd Fontsが必要)
exa -l --extended拡張属性(SELinux、ACL)を表示
exa -l@拡張属性の短縮形
exa -liinode 番号を表示
exa -lsブロックサイズを表示
exa -l --octal-permissions8進数形式(755)で権限を表示
exa -l --numericユーザー/グループ名の代わりに数値のユーザー/グループIDを表示
exa -l --time-style=isoISO形式のタイムスタンプ
exa -l --time-style=relative相対的な時間(例:「2時間前」)
exa -l --modified変更時間を表示(デフォルト)
exa -l --accessed最終アクセス時間を表示
exa -l --created作成時間を表示
exa --ignore-glob="*.tmp"パターンに一致するファイルを無視する
exa -lZSELinuxセキュリティコンテキストを表示
exa --tree --git --iconsGitステータスとアイコン付きのツリービュー
exa -R --level=3再帰的リスト表示を3レベルに制限

設定

シェルエイリアス

以下を追加してください ~/.bashrc~/.zshrc、または~/.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'

カラーカスタマイズ

環境変数を使用してカスタムカラーを設定: EXA_COLORS

# 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)

デフォルトオプション

デフォルトオプション用の関数ラッパーを作成:

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

一般的なユースケース

ユースケース: Gitリポジトリの検査

# 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"

ユースケース: 大きなファイルの検索

# 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

ユースケース: ファイル権限の監査

# 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

ユースケース: ディレクトリ構造の分析

# 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

ユースケース: 高速ファイル閲覧

# 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

ベストプラクティス

  • エイリアスの使用: シェルエイリアスを設定してlsexaに置き換え、ワークフロー全体で一貫した体験を提供
  • Nerd Fontsのインストール: アイコンを完全にサポートするため、ターミナルにNerd Font(例:FiraCode Nerd Font、Hack Nerd Font)をインストール
  • Gitとの組み合わせ: 常に

Would you like me to clarify or modify any part of the translation?--gitリポジトリ内のフラグを使用して、コマンドを実行せずにファイルの状態を一目で確認するgit status- ツリービューを活用: 使用するexa --tree別々にインストールする代わりにtreeコマンド、特に--level深さを制御するEXA_COLORS- 色を設定: カスタマイズする--time-style=relativeターミナルテーマに合わせて読みやすくする--time-style=iso- 時間スタイルオプションを使用: 選択する-1最近のファイル用または--color=never正確なタイムスタンプ用--git-ignore- スクリプトに適した出力: 使用する--sort(1行に1つ)と--reverse他のコマンドやスクリプトにパイプする際exa- gitignoreを尊重: 大規模なリポジトリでは、使用するexa -l --git --icons何千ものビルド成果物や依存関係をリストしないようにする

問題ソリューション
Icons not displaying correctlyNerd Fontをインストールし、ターミナルでそれを使用するように設定します。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 \
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 \
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
フラグ説明
-------------------
--modified or -m変更時間(デフォルト)
--accessed or -u最終アクセス時間
--created or -U作成時間
--time-style=isoISO形式
--time-style=long-iso長い ISO 形式
--time-style=full-isoフルISO(タイムゾーン付き)
--time-style=relative相対的な時間
ソート キー説明
-----------------------
name名前順(デフォルト)
sizeファイルサイズ
extensionファイル拡張子
modified更新時間
accessedアクセス時間
created作成時間
typeファイルタイプ (dir, file, link)
inodeIノード番号
oldest最初に古いもの(変更日の逆順)