igoryonya igoryonya - 10 months ago 58
Linux Question

linux "watch -c" (with color parameter), but commands display colorless output. Why?

When I do 'ls', or 'service some_service_name status', or any other command with colored output, it, "surprisingly" :), shows it's output in color, but when I run them with 'watch' and even with 'watch -c' command with a color enabling parameter, they still show without colors.

Why?, and how to fix it?

I think, it's a reasonable question, but whoever minuses, at least explain why you did so.


ls and others see that they are run from a script so they go to the default mode (without colors):

With --color=auto, ls emits color codes only when standard output is connected to a terminal.

try forcing the color output:

watch -c ls --color