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.
@Jacinto27

Copy link
Copy Markdown

Nice, thanks for sharing 🥇

@AppleBoiy

Copy link
Copy Markdown
Author

my pleasure💪🏻

@aaronedev

Copy link
Copy Markdown

yea good thanks

@w31r4

w31r4 commented Mar 20, 2025

Copy link
Copy Markdown

thx ; )

@kalpak92

Copy link
Copy Markdown

This is great. Thanks

@s-tlm

s-tlm commented May 4, 2025

Copy link
Copy Markdown

Thanks!

@Salman7236

Copy link
Copy Markdown

W

@Salman7236

Salman7236 commented Dec 1, 2025

Copy link
Copy Markdown

In the advance aliases, l and ls look exactly the same (grid view, icons), because the --header option in l would only work if -l (or --long) is also provided.
So instead of: alias l='eza -bGF --header --git --color=always --group-directories-first --icons'
it should be: alias l='eza -blGF --header --git --color=always --group-directories-first --icons'

@thiagozs

Copy link
Copy Markdown

Thanks, very nice alias!!!

@AvianAnalyst

Copy link
Copy Markdown

In the advance aliases, l and ls look exactly the same (grid view, icons), because the --header option in l would only work if -l (or --long) is also provided. So instead of: alias l='eza -bGF --header --git --color=always --group-directories-first --icons' it should be: alias l='eza -blGF --header --git --color=always --group-directories-first --icons'

Am I missing something? -G selects grid view right? but it seems incompatible iwth -l. adding and removing -G shows no visual difference for me, so am I missing something here? @Salman7236

@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