It is normally nice to have color output from ls
, grep
, etc. But when you don't want it (such as in a script where you're piping the results to another command) is there a switch that can turn it off? ls -G
turns it on (with some BSD-derived versions of ls
) if it's not the default, but ls +G
does not turn it off. Is there anything else that will?
Linux LS Command – How to Turn Off Color with ls
colorsls
Best Answer
Color output for
ls
is typically enabled through an alias in most distros nowadays.You can always disable an alias temporarily by prefixing it with a backslash.
Doing the above will short circuit the alias just for this one invocation. You can use it any time you want to disable any alias.