Turn off color in Linux terminal/bash session

I am a new GNU/Linux user. I see a colorful bash prompt. Traditional command such as grep command or ls command also display output in colors. I would also like a turn off colors in vim text editor. I do not like colors. How can I turn off color listing in Linux terminal?

You can disable all color in your shell. By default, colors are turned on by many commands. The xterm program is a terminal emulator for the X Window System. It enables colors too. Setting up TERM shell variable to VT220 or xterm-mono will also help. Let us see how to turn off colors in Linux terminal session.

How to setup TERM shell variable

The environment variable TERM contains a identifier for the text window’s capabilities. You can get a detailed list of these cababilities by using the infocmp command, using ‘man 5 terminfo’ as a reference. To see current value run the following echo command:
echo "$TERM"
Sample outputs:


So my xterm set with 256 colors. To make it mono set it too xterm-mono:
export TERM=xterm-mono
Better update your ~/.bashrc file with above line:
echo 'export TERM=xterm-mono' >> ~/.bashrc

Turn off color in Linux terminal for ls/grep/egrep commands

By default, ls command/grep command/nixcmd name=”egrep”] are aliased as follows:
type -a ls
alias ls='ls --color=auto'

You can verify it with the command command or type command as follows:
command -V grep
type -a grep
command -V egrep

To disable this, find and delete or comment out above lines in your ~/.bashrc or ~/.bash_aliases
#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'

Save and close the file. Use source command to update your settings:
source ~/.bashrc
source ~/.bash_aliases

See “How to create a permanent Bash alias on Linux/Unix” for more info.

How to disable vim text editor color syntax highlighting

Syntax highlighting is nothing but a feature of vi/vim text editors that displays text, especially source code, in different colors and fonts according to the category of terms. To turn it off, press ESC key, type the following when editing a file:
:syntax off
Update your ~/.vimrc file and delete line that read as follows:
syntax off
See “Turn On or Off Color Syntax Highlighting In vi or vim Editor for more info.

How to disable colorful bash prompt

Again edit your ~/.bashrc file:
vi ~/.bashrc
joe ~/.bashrc
Find and line that read as follows:
Comment it out:
Save and close the file. You must close and reopen your terminal app. Here is my terminal after disabling all colors:

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.