I spend most of my time working in Unix environments and using terminal emulators. I try to use color on the command line, because color makes the output more useful and intuitive.
What options exist to add color to my terminal environment? What tricks do you use? What pitfalls have you encountered?
Unfortunately, support for color varies depending on terminal type, OS, TERM setting, utility, buggy implementations, etc.
Here are some tips from my setup, after a lot of experimentation:
- I tend to set
TERM=xterm-color
, which is supported on most hosts (but not all). - I work on a number of different hosts, different OS versions, etc. I use everything from macOS X, Ubuntu Linux, RHEL/CentOS/Scientific Linux and FreeBSD. I'm trying to keep things simple and generic, if possible.
- I do a bunch of work using GNU
screen
, which adds another layer of fun. - Many OSs set things like
dircolors
and by default, and I don't want to modify this on a hundred different hosts. So I try to stick with the defaults. Instead, I tweak my terminal's color configuration. Use color for some Unix commands (
ls
,grep
,less
,vim
) and the Bash prompt. These commands seem to use the standard "ANSI escape sequences". For example:alias less='less --RAW-CONTROL-CHARS' export LS_OPTS='--color=auto' alias ls='ls ${LS_OPTS}'
I'll post my .bashrc
and answer my own question Jeopardy Style.
column -t --color
? – Tomáš Pospíšek Feb 13 '18 at 23:09