13

I can't figure out how to disable the colors in the terminal(just the default, gnu it's called?). Been looking for an hour and ran some code that I saw else where. Also tried emacs ~/.bashrc and added a line that was supposed to disable the color, it worked once then I closed the terminal, ls again, and the colors were back. Any help is great!

3
  • 2
    if you want it for just 1 command put a \ in front of the command ;-) (\ls -l will drop the colors too for that 1 time).
    – Rinzwind
    Aug 29, 2016 at 6:57
  • I need it permanently! haha but i'll remember that in case I am in ssh and tired of the color when I ls
    – Kdrumz
    Aug 29, 2016 at 6:59
  • I tried and couldn't quite get this to work, but shouldn't there be a way to do this by going into the preferences of the terminal emulator and setting all the colours to be black, white or grey?
    – bdsl
    Aug 29, 2016 at 14:16

4 Answers 4

11

In your .bashrc file, you'll find lines

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

Put a # comment sign in front of force_color_prompt=yes line and restart terminal. After the change, the line should be

#force_color_prompt=yes

Edit: This will turn of the color from terminal. But if some programs has color support built-in in them and if you want to turn them off too, follow @Zanna's answer. Basically you need to comment out the lines like alias ls='ls --color=auto' etc.

7
  • 2
    There was already a # in front of force_color_prompt=yes when I opened it up, and I haven't touched that before. Weird, anything else I could try?
    – Kdrumz
    Aug 29, 2016 at 6:56
  • 1
    That will set the color off. but some programs have color support such as ls and for stopping those colors, you need to comment out those lines. Zanna's answer show you how to do that
    – Anwar
    Aug 29, 2016 at 7:00
  • 1
    @KyleDrummond exit terminal and start it again
    – Anwar
    Aug 29, 2016 at 7:05
  • 7
    @KyleDrummond I am confused why you accepted Anwar's answer. Although Anwar's answer is correct, you never uncommented force_color_prompt in the first place, so this solution, while correct, does not solve your problem. The real solution that works is provided by Zanna.
    – edwinksl
    Aug 29, 2016 at 7:14
  • 1
    @edwinksl May be it because her answer didn't work first place without my exit terminal and start it again' comment!
    – Anwar
    Sep 3, 2016 at 2:38
10

If you have set a coloured prompt see @Anwar's answer

The colours from the output of commands such as ls are made by aliases.

To disable this, find and comment out (by inserting # at the start of the line) these lines in your ~/.bashrc

alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'

when done, source ~/.bashrc to get the immediate effect or just close the terminal and open a new one

3
  • That didn't work either. All of those are commented out and I ran source ~/.bashrc after I saved it.
    – Kdrumz
    Aug 29, 2016 at 7:02
  • 2
    @KyleDrummond that's weird but I see you got it working by opening a new terminal. btw, Anwar's answer just tells you how to stop the prompt (user@mycomputer:~$) from being colored, this one tells you how to stop colors in output from commands like ls which I think is what you wanted? Could you clarify as you accepted the other answer?
    – Zanna
    Aug 29, 2016 at 7:36
  • I've commented out the "force_color_prompt=yes" as @Anwar said and I've disabled all the lines you specified and yes the output of ls and grep doesn't show colors but the prompt is still colored.
    – Peachy
    Jan 11, 2017 at 14:58
2

A simple, elegant solution.

No code needed for "GNOME terminal": just follow these steps:

  1. Run gnome-terminal.
  2. Go to Terminal > Preferences.
  3. Go to Profiles.
  4. Select the profile you use, then click Clone.
  5. Go to Colours.
  6. Replace every color of the bottom row with #EEEEEC or the rightmost color you have set.
  7. Replace every color of the top row with #300A24 (default GTK theme background color) or the one your theme has. If you have disabled the system theme, set them to the "Background colour" instead.

Now you are almost done, but I recommend you to do these steps:

  1. Go to General
  2. Change the profile name to something like <PROFILE> (monochrome), replacing <PROFILE> with your old profile name.

Regardless of the above steps, you also need to follow these in order to successfully create your new profile:

  1. Close the Editing Profile window.
  2. On the drop-down menu, select the new profile you just created.
  3. Restart gnome-terminal.
2
  • Of course, the other simple approach is to tell all programs that your terminal does not have colour, by picking (or constructing) an appropriate terminal type. I'm surprised that no-one has suggested it.
    – JdeBP
    Aug 29, 2016 at 19:37
  • @JdeBP Ironically, contest is of good quality... this is my method, and it covers all programs. It does not show strange escape sequences or colors in parentheses or.... and, some programs do not have such an option.
    – EKons
    Aug 30, 2016 at 5:19
0

Setting terminal features (like colors) via the TERM variable works for me:

unset LS_COLORS
TERM=xterm-mono
export TERM
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .