When using less
to view the output of a command like ls
, colors will usually be turned off. So when you run a pipeline such as ls | less
, you will see boring black and white output. To enable it anyway you need to write ls --color=always | less -r
instead.
Here's a list of commands and their respective flags to force color:
ls --color=always
tree -C
grep --color=always
git <command> --color=always
gradle --console rich <task>