4 ms·
Neither ls nor grep output color by default. Most distributions have a bashrc script that sets aliases like: alias grep='grep --color=auto' alias ls='ls --
by gizmo686 4y ago
Neither ls nor grep output color by default. Most distributions have a bashrc script that sets aliases like:
alias grep='grep --color=auto'
alias ls='ls --color=auto'
Ls and grep are defined such that you can specify --color multiple times and the last one will take effect, allowing you to disable coloring while still using the alias that enables it. The FAQ at no-color.org states:
> User-level configuration files and per-instance command-line arguments should override $NO_COLOR
So, it looks like like ls and grep respect it fine with just their default behaviour.
As an aside, at least on my system, ls and grep do not recognize --no-color. I need to specify it with --color=never.