I've set the TERM variable value to linux-m to have a monochrome terminal. What's peculiar it doesn't changed anything - when i issue ls -l or grep --color i still get colorized results. Why does it returns colors if the terminal is no-color?

For previous information on this see Changing TERM variable and color output. It's related but has another focus.


Each command (program) has its own options and they override common options of terminal at all.

By steps:

1. to have monochrome prompt

Open your ~/.bashrc file. Find strings begins from PS1=, PS2=, PS3=, PS4= and comment them (place # at the beginning).

2.1 to have monochrome ls output

Find file ~/.dircolors and rename it to ~/.dircolors_old

2.2 to have monochrome grep output

grep takes its colors from environment variable GREP_COLORS (deprecated GREP_COLOR). It might be set in ~/.bashrc. You should comment it too.

  • PS1 only controls the prompt, how would this help the questioner solve his problem? – mtak Jan 29 '18 at 12:13
  • updated answer.. – Drakonoved Jan 29 '18 at 12:26
  • 1
    All the PS variables are just for controlling prompts... Maybe it would be easier if you added how would this help? – mtak Jan 29 '18 at 12:57
  • updated answer.. – Drakonoved Jan 29 '18 at 13:42
  • And .dircolors only works for ls output. grep --color will still have colored output with your answer. I'm pretty sure the questioner wants a universal solution for his problem. – mtak Jan 29 '18 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.