Skip to content

Instantly share code, notes, and snippets.

@AppleBoiy
Last active July 18, 2026 14:36
Show Gist options
  • Select an option

  • Save AppleBoiy/04a249b6f64fd0fe1744aff759a0563b to your computer and use it in GitHub Desktop.

Select an option

Save AppleBoiy/04a249b6f64fd0fe1744aff759a0563b to your computer and use it in GitHub Desktop.
eza aliases for ls — updated, pipe-safe setup

eza aliases for ls

A small, pipe-safe alias set for eza.

Install

brew install eza

Add the aliases below to ~/.zshrc or ~/.bashrc.

Recommended setup

# Long views
alias l='eza -blF --git --header --group-directories-first --icons=auto --color=auto'
alias ll='eza -la --git --header --octal-permissions --group-directories-first --icons=auto --color=auto'
alias la='eza -la --git --header --group-directories-first --icons=auto --color=auto'
alias lm='eza -l --git --header --sort=modified --reverse --group-directories-first --icons=auto --color=auto'

# Compact and specialist views
alias l1='eza --oneline --group-directories-first --icons=auto --color=auto'
alias lt='eza --tree --level=2 --group-directories-first --icons=auto --color=auto'
alias l.='eza -a --oneline --color=never | grep -E "^\."'

This setup intentionally leaves the system ls command unchanged. If you prefer eza as a direct replacement, add:

alias ls='eza --group-directories-first --icons=auto --color=auto'

Then reload the shell configuration:

source ~/.zshrc
# or
source ~/.bashrc

About --grid and --long

-G (--grid) and -l (--long) can be combined. eza calls this its grid-details view. Depending on terminal width, the number of entries, and EZA_GRID_ROWS, it may look the same as a normal long view.

Options such as --header, --git, and -b belong to the long view, so include -l when using them. For example:

eza -blGF --header --git

The recommended aliases use --color=auto and --icons=auto so redirected or piped output does not contain unwanted terminal formatting.

Changes in this revision

  • Added the missing long-view flag where metadata columns are expected.
  • Clarified that grid and long modes can be combined.
  • Made colors and icons safe for pipes and redirected output.
  • Removed duplicated aliases and corrected the shell code fences.
  • Kept the original ls behavior unless replacement is explicitly enabled.
@AppleBoiy

Copy link
Copy Markdown
Author

You are right that -G selects grid view. It is compatible with -l; eza calls the combination its grid-details view. Depending on terminal width, the number of entries, and EZA_GRID_ROWS, it can look identical to the regular long view, which is why toggling -G may show no visible difference.

The important part of the earlier correction is adding -l, because --header, --git, and -b are long-view options. I have updated the Gist to clarify this and refreshed the aliases to use pipe-safe automatic colors and icons. Thanks for raising it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment