Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colorize fish -ls

How do I colorize the ls command in fish? I am using ITerm2 on Mac with appropriate fonts etc. For some reason it stopped working on my computer. When I do the recommended

 function ls
   command ls --color=auto $argv
 end 

I get that the --color command is not recognized ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]

I thought it might be due to installing gnucoreutils and writing over fish's ls command, but removing it did not seem to help. When I do ls -G via alias, I can get colorized output for folders for a session, but it resets at end of session back to the original. Any idea what might be the problem?

like image 665
bkapz Avatar asked Feb 19 '26 09:02

bkapz


1 Answers

The /bin/ls command on macOS has different options than the GNU Linux version. Replace --color=auto with -G. Alternatively, install the GNU version using Homebrew to install the "coreutils" package. Then invoke it as gls.

like image 85
Kurtis Rader Avatar answered Feb 22 '26 01:02

Kurtis Rader



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!