Disable color in shell/terminal

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

0

6 Answers

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)

7

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.

2
xterm -cm 

This will start an xterm with no colors.

3

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.

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 

make a backup of .bashrc and then open .bashrc and remove all of these lines. this has the added benefit of disabling text colors in gedit!

# set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm|xterm-color|*-256color) color_prompt=yes;; esac # 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 if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then if [[ ${EUID} == 0 ]] ; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' else PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] ' fi else PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h \w\a\]$PS1" ;; *) ;; esac # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like