How to change the color for a broken symlink flashing red

Project:Linux Distribution
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Project wiki:New Linux Distribution
Related pages:#6152: ls
Description

How to change the color for a broken symlink flashing red?

Comments

#1

the ls man page says:

Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it.

#2

While searching for this, I stumbled upon this little problem: #6153: No menu in node `(coreutils.info.bz2)coreutils invocation'.

In konqueror, info:dircolors works.

#3

$ dircolors --print-database
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

ORPHAN 01;05;37;41 # orphaned syminks
MISSING 01;05;37;41 # ... and the files they point to

#4

from the info page:

To make ‘dircolors’ read a ‘~/.dircolors’ file if it exists, you can put the following lines in your ‘~/.bashrc’ (or adapt them to your favorite shell):
d=.dircolors
test -r $d && eval "$(dircolors $d)"

#5

from the info page:

To make ‘dircolors’ read a ‘~/.dircolors’ file if it exists, you can put the following lines in your ‘~/.bashrc’ (or adapt them to your favorite shell):
d=.dircolors
test -r $d && eval "$(dircolors $d)"

#6

~/.bashrc

# Change the color for a broken symlink flashing red
# http://linux.overshoot.tv/ticket/6154
d=~/.dircolors
test
-r $d && eval "$(dircolors $d)"

~/.dircolors

ORPHAN 01;37;41 # orphaned syminks
MISSING 01;37;41 # ... and the files they point to

the above works, but despite the limited amount of changes, it changed some other colors as well, e.g. .pdf files that used to be coloured green are now the default white??

#7

Oh!
Having a custom .dircolors file overrides all the inbuilt colors, which is a bit counter-intuitive.

So I did:
$ dircolors --print-database > ~/.dircolors

and then edited the file and removed all the '05' (i.e. blink) in the file (there were only 2).
done.

#8

Project:Linux software» Linux Distribution

I think:

1- there should be a mechanism to more easily discover which configuration files dircolors (and any other software) reads upon start-up. Something like:

$ dircolors --list-config-files
/home/user/.dircolors

The output should be in order the files are being processed.
This option should be implemented for all software, for easier debug, etc.
Almost all software have the --version and --help options. This is another one that should be added to most.

2- the documentation is not clear enough. I'll add something in the wiki to compensate.

3- dircolors should use overrides, i.e. start with the colors hard-coded in the application, then use a system-wide global override file, if one is set up, then use a user file.

4- reading the documentation, it is not clear if we can have a per-directory .dircolors file that would override all of the previous configurations? It may be useful for some projects where, e.g., .txt files have a special meaning that is different from elsewhere. ???