Operating System - Linux
1827979 Members
2629 Online
109973 Solutions
New Discussion

Disable the colours that are displayed with a shell when I run a “ls” command

 
SOLVED
Go to solution
Rui Vilao
Regular Advisor

Disable the colours that are displayed with a shell when I run a “ls” command

Greetings,

I am still quite new to Linux and too used to HP-UX…

Is it possible to disable the colours that are displayed with a shell when I run a “ls” command (btw what is the meaning of it). The blue is extremely difficult to read…

Any help/suggestion is highly appreciated.

TIA.

Kind Regards,

Rui Vilao.
"We should never stop learning"_________ rui.vilao@rocketmail.com
7 REPLIES 7
Vipulinux
Respected Contributor
Solution

Re: Disable the colours that are displayed with a shell when I run a “ls” command

Hi
The One's in blue represent directory
The green are executable files


If you dont want colors use:
"ls --color=never"

you can also put this is alias file so sas colors are never shown with ls command.

Cheers
Mike Stroyan
Honored Contributor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

The default for the ls --color option is 'never'. Most distributions set up an alias from ls to 'ls --color=tty' or 'ls --color=auto' so that output to a tty will be colored. You could use 'unalias ls' to remove that alias. Or you could find the place that sets the alias and comment that out. (It may be done in a system-wide file like /etc/profile.d/colorls.sh that affects all accounts on the system.)
You can also change the colors used to pick ones that work better for you. Run 'dircolors --print-database > mycolors'. Edit mycolors and choose colors as described in the comments. Then use ' eval $(dircolors) ' in .bashrc to set LS_COLORS to match your choices.
dirk dierickx
Honored Contributor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

on the question why they do this;
using colors you can quickly determine what each listing of the 'ls' command is depending on the color. dark blue is a directory, yellow a link and blinking red is a broken symbolic link etc. (these are just examples, but you get the idea i guess).
you can not do this with the 'normal' ls output, unless you do ll, 'ls -l' or 'ls -p'.
Jess Long
Frequent Advisor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

Rui:

Take a look at the man page for dir_colors.
It explains all regarding the use of colors with the 'ls' command.
Rui Vilao
Regular Advisor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

Hi all,

thanks to all for your replies (I will assign points as soon as I close this thread)...

Just a last question: what about the enabling/disabling of colours within vi editor in Linux?

TIA,

Rui.
"We should never stop learning"_________ rui.vilao@rocketmail.com
Jess Long
Frequent Advisor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

Rui:

You can disable the colors in vi/vim/gvim with the use of an RC file in your home directory.

See the example file at /usr/share/vim/vimXX/vim_example.vim, where the XX is your version of vim.

If you are using gvim, then you will want to look at gvim_example.vim.

Hope it helps.
JL
Mike Stroyan
Honored Contributor

Re: Disable the colours that are displayed with a shell when I run a “ls” command

You can enable and disable vim syntax highlighting with
:syntax on
:syntax off
You can enable and disable search pattern highlighting with
:set hls
:set nohls
You can change colors used for syntax highlighting with
:colorscheme blue
:colorscheme darkblue
:colorscheme default
:colorscheme delek
:colorscheme desert
:colorscheme elflord
:colorscheme evening
:colorscheme koehler
:colorscheme morning
:colorscheme murphy
:colorscheme pablo
:colorscheme peachpuff
:colorscheme ron
:colorscheme shine
:colorscheme torte
:colorscheme zellner
It is also possible to create new vim colorschemes and syntax as described by
:help highlight