Which program really messed up with my ls
cmd in the first place, is it python?
Your ls
command is untouched. Your ls
alias most likely comes from an erroneous Bourne Again shell setup.
Note that your ls
alias is running a command named grc
, via another alias named colourify
. This comes from Radovan Garabík's Generic Colourizer, whose Bourne Again shell aliases (in grc.bashrc
) and Z shell aliases (in grc.zsh
) set up an alias named ls
.
Somewhere, in an rc file, you are adding these aliases to your interactive Bourne Again shell, per recommendations like this Stack Overflow answer.
The Z shell alias is
alias ls="grc --colour=auto ls"
which passes the
--colour-auto
option to the
grc
command, which is the command that takes that option.
However, The Bourne Again shell alias is
alias ls='colourify ls --color'
which is (via the
colourify
alias) effectively
alias ls='grc -es --colour=auto ls --color'
which is
both running the output of the
ls
command through a colourizer
and trying to get the
ls
command to colourize its output.
The basic problem is that the author of these Bourne Shell aliases (which was Isaias Piña from Oracle in May 2016) hasn't catered for running the Bourne Again shell on anything other than a Linux operating system, probably expecting that if you are using MacOS you are using something like Oh My Zsh. An additional problem is that the author hasn't allowed for grc
to colourize the output of ls
and is, rather, expecting ls
to colourize its own output.
So you have a number of options:
- Find where you are adding these aliases and fix Isaias Piña's erroneous
ls
alias to use the -G
option on MacOS.
- Find where you are adding these aliases and fix Isaias Piña's erroneous
ls
alias to not use any option and instead rely upon the colourizer's conf.ls
file to do its actual job; as Tom Mulder has.
- Find where you are adding these aliases and remove Isaias Piña's erroneous
ls
alias entirely, using the CLICOLOR
environment variable for colourization instead; as Noel B Alonso does.
- Find where you are adding these aliases and remove Isaias Piña's erroneous
ls
alias entirely, using your own ls
alias; as Arthur Nisnevich does.
- Uninstall the Generic Colourizer entirely.
- Use the Z shell.
unalias ls
– kmkaplan Feb 05 '17 at 07:37unalias ls
works but then I've to run this command each time I open a new terminal window. Which program really messed up with myls
cmd in the first place, is it python? – Shah-G Feb 05 '17 at 07:42