Is it possible to "alias" all commands to append --color? Or instead have it automatically activated for every program that supports it?
How would the shell know automatically which programs support the --color option? You'd have to give it a list, and as long as you're going to do that you might as well just give it a list of alias commands to run. I suppose it could be done programmatically by something like this (in bash):
for cmd in ls blah foo; do
alias "$cmd=$cmd --color"
done
There are really very few programs that support the --color
option, and they aren't actually written by a single organization. Thus, they don't refer to a central location for their options. Heck, the don't even have a uniform argument set, so just the --color
option to the end of every command would probably cause a lot of damage!
I'm afraid you'd have to alias each and one. For example, for ls
:
alias ls='ls --color'
You should be careful with this, especially when chaining invocations.
grep --color=yes 'foo' bar.txt | less #leads to weird ANSI stuff in output
grep --color=yes 'foo' bar.txt | less -R #binary codes interpreted as colors
Basically, this can screw up pipelining...I'd recommend aliasing things with colorized output to separate commands to avoid doing "cmd | myprog" and getting weird results due to embedded ANSI.
instead of trying to change each command
why not just change the way your console displays colors