1DIR_COLORS(5) Linux User Manual DIR_COLORS(5)
2
3
4
6 dir_colors - configuration file for dircolors(1)
7
9 The program ls(1) uses the environment variable LS_COLORS to determine
10 the colors in which the filenames are to be displayed. This environ‐
11 ment variable is usually set by a command like
12
13 eval `dircolors some_path/dir_colors`
14
15 found in a system default shell initialization file, like /etc/profile
16 or /etc/csh.cshrc. (See also dircolors(1).) Usually, the file used
17 here is /etc/DIR_COLORS and can be overridden by a .dir_colors file in
18 one's home directory.
19
20 This configuration file consists of several statements, one per line.
21 Anything right of a hash mark (#) is treated as a comment, if the hash
22 mark is at the beginning of a line or is preceded by at least one
23 whitespace. Blank lines are ignored.
24
25 The global section of the file consists of any statement before the
26 first TERM statement. Any statement in the global section of the file
27 is considered valid for all terminal types. Following the global sec‐
28 tion is one or more terminal-specific sections, preceded by one or more
29 TERM statements which specify the terminal types (as given by the TERM
30 environment variable) the following declarations apply to. It is
31 always possible to override a global declaration by a subsequent termi‐
32 nal-specific one.
33
34 The following statements are recognized; case is insignificant:
35
36 TERM terminal-type
37 Starts a terminal-specific section and specifies which terminal
38 it applies to. Multiple TERM statements can be used to create a
39 section which applies for several terminal types.
40
41 COLOR yes|all|no|none|tty
42 (Slackware only; ignored by GNU dircolors(1).) Specifies that
43 colorization should always be enabled (yes or all), never
44 enabled (no or none), or enabled only if the output is a termi‐
45 nal (tty). The default is no.
46
47 EIGHTBIT yes|no
48 (Slackware only; ignored by GNU dircolors(1).) Specifies that
49 eight-bit ISO 8859 characters should be enabled by default. For
50 compatibility reasons, this can also be specified as 1 for yes
51 or 0 for no. The default is no.
52
53 OPTIONS options
54 (Slackware only; ignored by GNU dircolors(1).) Adds command-
55 line options to the default ls command line. The options can be
56 any valid ls command-line options, and should include the lead‐
57 ing minus sign. Note that dircolors does not verify the valid‐
58 ity of these options.
59
60 NORMAL color-sequence
61 Specifies the color used for normal (non-filename) text.
62
63 FILE color-sequence
64 Specifies the color used for a regular file.
65
66 DIR color-sequence
67 Specifies the color used for directories.
68
69 LINK color-sequence
70 Specifies the color used for a symbolic link.
71
72 ORPHAN color-sequence
73 Specifies the color used for an orphaned symbolic link (one
74 which points to a nonexistent file). If this is unspecified, ls
75 will use the LINK color instead.
76
77 MISSING color-sequence
78 Specifies the color used for a missing file (a nonexistent file
79 which nevertheless has a symbolic link pointing to it). If this
80 is unspecified, ls will use the FILE color instead.
81
82 FIFO color-sequence
83 Specifies the color used for a FIFO (named pipe).
84
85 SOCK color-sequence
86 Specifies the color used for a socket.
87
88 DOOR color-sequence
89 (Supported since fileutils 4.1) Specifies the color used for a
90 door (Solaris 2.5 and later).
91
92 BLK color-sequence
93 Specifies the color used for a block device special file.
94
95 CHR color-sequence
96 Specifies the color used for a character device special file.
97
98 EXEC color-sequence
99 Specifies the color used for a file with the executable
100 attribute set.
101
102 LEFTCODE color-sequence
103 Specifies the left code for non-ISO 6429 terminals (see below).
104
105 RIGHTCODE color-sequence
106 Specifies the right code for non-ISO 6429 terminals (see below).
107
108 ENDCODE color-sequence
109 Specifies the end code for non-ISO 6429 terminals (see below).
110
111 *extension color-sequence
112 Specifies the color used for any file that ends in extension.
113
114 .extension color-sequence
115 Same as *.extension. Specifies the color used for any file that
116 ends in .extension. Note that the period is included in the
117 extension, which makes it impossible to specify an extension not
118 starting with a period, such as ~ for emacs backup files. This
119 form should be considered obsolete.
120
121 ISO 6429 (ANSI) Color Sequences
122 Most color-capable ASCII terminals today use ISO 6429 (ANSI) color
123 sequences, and many common terminals without color capability, includ‐
124 ing xterm and the widely used and cloned DEC VT100, will recognize ISO
125 6429 color codes and harmlessly eliminate them from the output or emu‐
126 late them. ls uses ISO 6429 codes by default, assuming colorization is
127 enabled.
128
129 ISO 6429 color sequences are composed of sequences of numbers separated
130 by semicolons. The most common codes are:
131
132 0 to restore default color
133 1 for brighter colors
134 4 for underlined text
135 5 for flashing text
136 30 for black foreground
137 31 for red foreground
138 32 for green foreground
139 33 for yellow (or brown) foreground
140 34 for blue foreground
141 35 for purple foreground
142 36 for cyan foreground
143 37 for white (or gray) foreground
144 40 for black background
145 41 for red background
146 42 for green background
147 43 for yellow (or brown) background
148 44 for blue background
149 45 for purple background
150 46 for cyan background
151 47 for white (or gray) background
152
153 Not all commands will work on all systems or display devices.
154
155 ls uses the following defaults:
156
157 NORMAL 0 Normal (non-filename) text
158 FILE 0 Regular file
159 DIR 32 Directory
160 LINK 36 Symbolic link
161 ORPHAN undefined Orphaned symbolic link
162 MISSING undefined Missing file
163 FIFO 31 Named pipe (FIFO)
164 SOCK 33 Socket
165 BLK 44;37 Block device
166 CHR 44;37 Character device
167 EXEC 35 Executable file
168
169 A few terminal programs do not recognize the default properly. If all
170 text gets colorized after you do a directory listing, change the NORMAL
171 and FILE codes to the numerical codes for your normal foreground and
172 background colors.
173
174 Other Terminal Types (Advanced Configuration)
175 If you have a color-capable (or otherwise highlighting) terminal (or
176 printer!) which uses a different set of codes, you can still generate a
177 suitable setup. To do so, you will have to use the LEFTCODE, RIGHT‐
178 CODE, and ENDCODE definitions.
179
180 When writing out a filename, ls generates the following output
181 sequence: LEFTCODE typecode RIGHTCODE filename ENDCODE, where the type‐
182 code is the color sequence that depends on the type or name of file.
183 If the ENDCODE is undefined, the sequence LEFTCODE NORMAL RIGHTCODE
184 will be used instead. The purpose of the left- and rightcodes is
185 merely to reduce the amount of typing necessary (and to hide ugly
186 escape codes away from the user). If they are not appropriate for your
187 terminal, you can eliminate them by specifying the respective keyword
188 on a line by itself.
189
190 NOTE: If the ENDCODE is defined in the global section of the setup
191 file, it cannot be undefined in a terminal-specific section of the
192 file. This means any NORMAL definition will have no effect. A differ‐
193 ent ENDCODE can, however, be specified, which would have the same
194 effect.
195
196 Escape Sequences
197 To specify control- or blank characters in the color sequences or file‐
198 name extensions, either C-style \-escaped notation or stty-style
199 ^-notation can be used. The C-style notation includes the following
200 characters:
201
202 \a Bell (ASCII 7)
203 \b Backspace (ASCII 8)
204 \e Escape (ASCII 27)
205 \f Form feed (ASCII 12)
206 \n Newline (ASCII 10)
207 \r Carriage Return (ASCII 13)
208 \t Tab (ASCII 9)
209 \v Vertical Tab (ASCII 11)
210 \? Delete (ASCII 127)
211 \nnn Any character (octal notation)
212 \xnnn Any character (hexadecimal notation)
213 \_ Space
214 \\ Backslash (\)
215 \^ Caret (^)
216 \# Hash mark (#)
217
218 Please note that escapes are necessary to enter a space, backslash,
219 caret, or any control character anywhere in the string, as well as a
220 hash mark as the first character.
221
223 /etc/DIR_COLORS
224 System-wide configuration file.
225
226 ~/.dir_colors
227 Per-user configuration file.
228
229 This page describes the dir_colors file format as used in the fileu‐
230 tils-4.1 package; other versions may differ slightly.
231
233 The default LEFTCODE and RIGHTCODE definitions, which are used by ISO
234 6429 terminals are:
235
236 LEFTCODE \e[
237 RIGHTCODE m
238
239 The default ENDCODE is undefined.
240
242 dircolors(1), ls(1), stty(1), xterm(1)
243
245 This page is part of release 3.22 of the Linux man-pages project. A
246 description of the project, and information about reporting bugs, can
247 be found at http://www.kernel.org/doc/man-pages/.
248
249
250
251GNU 2001-12-26 DIR_COLORS(5)