Disable color in shell/terminal

52,454

Solution 1

if you are using PUTTY to remotely access the shell, then:
- on the left panel, click Colors
- uncheck the three boxes on the right panel (they are checked by default)

Solution 2

unset LS_COLORS; export TERM=xterm should do it, or at least get you most of the way there. You may need to change that to say TERM=vt220 for some overly "smart" programs.

Solution 3

xterm -cm

This will start an xterm with no colors.

Solution 4

The best way is probably to tell your terminal emulator and environment that it cannot support colors in the first place:

cat << EOF >> ~/.bashrc
unset LS_COLORS
TERM=xterm-mono
export TERM
EOF

Solution 5

I encountered the same problem while writing an SSH robot in Python (colors came out as jibberish when run through Visual Studio). The simplest solution was to open a new shell inside the other shell that was running.

sh

This opened a fresh shell without any of my settings and all printouts was monochrome. It also reset the prompt which was a bonus for my intended purpose.

Share:
52,454

Related videos on Youtube

Poe
Author by

Poe

Updated on September 18, 2022

Comments

  • Poe
    Poe over 1 year

    I want to disable all color in my shell. Not ls, not nano, not vi, nothing. What's the best way to achieve this?

  • Poe
    Poe about 13 years
    I'll have to switch to a terminal program that lets me do this. Thanks.
  • ocodo
    ocodo about 13 years
    Definitely recommend VT220 over XTERM.
  • ocodo
    ocodo about 13 years
    Geekosaur's answer is better for you, really.
  • Poe
    Poe about 13 years
    @slomojo his answer didn't work with my terminal client
  • ocodo
    ocodo about 13 years
    Oh, interesting, which client is it?
  • Poe
    Poe about 13 years
    I'm using iTerm (OS X) and still getting color if I export TERM=vt220, and in 'ls' even after unsetting LS_COLORS
  • Sophearith Put
    Sophearith Put about 13 years
    Same thing for me using Putty from Windows XP into a Centos 5.5 system. In other words, the ls command still gives colors after unsetting LS_COLORS.<br />Poe, if my answer works for you, please choose it as the answer.
  • Idelic
    Idelic about 13 years
    "xterm" is a color terminal, to disable colors you need TERM=xterm-mono
  • lzap
    lzap over 7 years
    This won't work if you have LS_COLORS set FYI.
  • Haydentech
    Haydentech almost 5 years
    This is the best answer. Also, @lzap appears to be incorrect, at least on Ubuntu. xterm -cm give me a no-color terminal on Ubuntu regardless of LS_COLORS.
  • lzap
    lzap over 4 years
    Well I meant that it will break terminal on Red Hat systems with LS_COLORS set by default.
  • Salvador Valencia
    Salvador Valencia over 3 years
    Also, if you have Putty already open in a session, you can click on the window menu (on the top left corner) to bring the 'right panel'. Click on Settings... and then Colors