Disable color in shell/terminal
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.
Related videos on Youtube
Poe
Updated on September 18, 2022Comments
-
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 about 13 yearsI'll have to switch to a terminal program that lets me do this. Thanks.
-
ocodo about 13 yearsDefinitely recommend VT220 over XTERM.
-
ocodo about 13 yearsGeekosaur's answer is better for you, really.
-
Poe about 13 years@slomojo his answer didn't work with my terminal client
-
ocodo about 13 yearsOh, interesting, which client is it?
-
Poe about 13 yearsI'm using iTerm (OS X) and still getting color if I export TERM=vt220, and in 'ls' even after unsetting LS_COLORS
-
Sophearith Put about 13 yearsSame 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 about 13 years"xterm" is a color terminal, to disable colors you need TERM=xterm-mono
-
lzap over 7 yearsThis won't work if you have LS_COLORS set FYI.
-
Haydentech almost 5 yearsThis 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 over 4 yearsWell I meant that it will break terminal on Red Hat systems with LS_COLORS set by default.
-
Salvador Valencia over 3 yearsAlso, 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