Scenario / Questions
When I have dircolors defined life is full of… color.
When I pipe
less to scroll around I lose the colors.
Find below all possible solutions or suggestions for the above questions..
Most likely your
ls is aliased to
ls --color=auto, which tells
ls to only use colors when its output is a tty. If you do
ls --color (which is morally equivalent to
ls --color=always), that will force it to turn on colors.
You could also change your alias to do that, but I wouldn’t really call that a good idea. Better to make a different alias with
Try less with the -R option like this:
command | less -R
This works for me in a one-liner like this:
ls -la | grep --color=always bash | less -r
And like this too:
ls --color | less -R
But you have to tweak the primary output (the output of ls in this case) a bit with the –color parameter.
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.