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:
xterm-256color
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
OR
joe ~/.bashrc
Find and line that read as follows:
force_color_prompt=yes
Comment it out:
#force_color_prompt=yes
Save and close the file. You must close and reopen your terminal app. Here is my terminal after disabling all colors:
- How to enable colorized output for ls command in MacOS X Terminal
- How To Turn On/Off Colors For ls Command In Bash On a Linux/Unix
- Turn off color in Linux terminal/bash session
- Turn On or Off Color Syntax Highlighting In vi or vim Editor
- BASH Shell: Change The Color of My Shell Prompt Under Linux or UNIX
🐧 5 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I do not have a .bashrc or a .bash_aliases. I am on a VM linux host on GoDaddy. It would be helpful if you gave the command line command to turn off the coloring.
May I know your Linux distro?
When disabling color with ls, it might be useful to use the -F option to append a symbol at the end of filenames to quickly indicate their type (folder, executable, link, ..).
I like my terminals white, the way xterm and Sun consoles used to be, and I’ve found vim no longer follows the base colour of the terminal, but instead insists on black. How do I force it to conform to my terminal customisation? I’m on Calculate, a Gentoo derivative.
Seems the vim problem is actually a long-standing issue with vim changing background colour based not on configured colours but on the default for the terminal program (xfce4-terminal in my case.) Apparently no one has fixed the bug.
Changing colorscheme to peachpuff is a temporary fix though.