OSETC TECH

Disable or Trun Off Color in Linux Bash Sheel or Terminal

This post will guide you how to trun off color for ls or grep command on Linux terminal. How do I disable colors in Linux shell or terminal. How to turn off colors in vi/vim editor in Linux.

Turn off color in Linux terminal


If you want to turn off color in linux bash or sh terminal, you need to un-alias all ls or grep, egrep commands in .bashrc or .bash_profile files. You can use type or command command to check if the ls or grep command has set alias variabe. just like this:

#type -a ls

or

# command -V grep

outputs:

[root@osetc_x8664 ~]# type -a ls
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
[root@osetc_x8664 ~]# type -a grep
grep is aliased to `grep --color=auto'
grep is /usr/bin/grep
[root@osetc_x8664 ~]# command -V grep
grep is aliased to `grep --color=auto'

So to disable colors for those commands, you need to delete or comment out all above alias line for those commands. Just like this:

#alias ls='ls --color=auto'
#alias grep='grep --color-auto'

Trun off color for Vi/Vim editor


To disable color for vi or vim text editor, you just need to press ESC key, and then type :syntax off command.
Or you can also try to update the .vimrc file, and delete “syntax on” line and add the below line into the file.

syntax off