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 windows 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:
Turn off color in Linux terminal unix bash session

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.