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 (nonfilename) text.
62
63 Synonym: NORM.
64
65 FILE color-sequence
66 Specifies the color used for a regular file.
67
68 DIR color-sequence
69 Specifies the color used for directories.
70
71 LINK color-sequence
72 Specifies the color used for a symbolic link.
73
74 Synonyms: LNK, SYMLINK.
75
76 ORPHAN color-sequence
77 Specifies the color used for an orphaned symbolic link (one
78 which points to a nonexistent file). If this is unspecified, ls
79 will use the LINK color instead.
80
81 MISSING color-sequence
82 Specifies the color used for a missing file (a nonexistent file
83 which nevertheless has a symbolic link pointing to it). If this
84 is unspecified, ls will use the FILE color instead.
85
86 FIFO color-sequence
87 Specifies the color used for a FIFO (named pipe).
88
89 Synonym: PIPE.
90
91 SOCK color-sequence
92 Specifies the color used for a socket.
93
94 DOOR color-sequence
95 (Supported since fileutils 4.1) Specifies the color used for a
96 door (Solaris 2.5 and later).
97
98 BLK color-sequence
99 Specifies the color used for a block device special file.
100
101 Synonym: BLOCK.
102
103 CHR color-sequence
104 Specifies the color used for a character device special file.
105
106 Synonym: CHAR.
107
108 EXEC color-sequence
109 Specifies the color used for a file with the executable
110 attribute set.
111
112 SUID color-sequence
113 Specifies the color used for a file with the set-user-ID
114 attribute set.
115
116 Synonym: SETUID.
117
118 SGID color-sequence
119 Specifies the color used for a file with the set-group-ID
120 attribute set.
121
122 Synonym: SETGID.
123
124 STICKY color-sequence
125 Specifies the color used for a directory with the sticky
126 attribute set.
127
128 STICKY_OTHER_WRITABLE color-sequence
129 Specifies the color used for an other-writable directory with
130 the executable attribute set.
131
132 Synonym: OWT.
133
134 OTHER_WRITABLE color-sequence
135 Specifies the color used for an other-writable directory without
136 the executable attribute set.
137
138 Synonym: OWR.
139
140 LEFTCODE color-sequence
141 Specifies the left code for non-ISO 6429 terminals (see below).
142
143 Synonym: LEFT.
144
145 RIGHTCODE color-sequence
146 Specifies the right code for non-ISO 6429 terminals (see below).
147
148 Synonym: RIGHT.
149
150 ENDCODE color-sequence
151 Specifies the end code for non-ISO 6429 terminals (see below).
152
153 Synonym: END.
154
155 *extension color-sequence
156 Specifies the color used for any file that ends in extension.
157
158 .extension color-sequence
159 Same as *.extension. Specifies the color used for any file that
160 ends in .extension. Note that the period is included in the
161 extension, which makes it impossible to specify an extension not
162 starting with a period, such as ~ for emacs backup files. This
163 form should be considered obsolete.
164
165 ISO 6429 (ANSI) color sequences
166 Most color-capable ASCII terminals today use ISO 6429 (ANSI) color
167 sequences, and many common terminals without color capability, includ‐
168 ing xterm and the widely used and cloned DEC VT100, will recognize ISO
169 6429 color codes and harmlessly eliminate them from the output or emu‐
170 late them. ls uses ISO 6429 codes by default, assuming colorization is
171 enabled.
172
173 ISO 6429 color sequences are composed of sequences of numbers separated
174 by semicolons. The most common codes are:
175
176 0 to restore default color
177 1 for brighter colors
178 4 for underlined text
179 5 for flashing text
180 30 for black foreground
181 31 for red foreground
182 32 for green foreground
183 33 for yellow (or brown) foreground
184 34 for blue foreground
185 35 for purple foreground
186 36 for cyan foreground
187 37 for white (or gray) foreground
188 40 for black background
189 41 for red background
190 42 for green background
191 43 for yellow (or brown) background
192 44 for blue background
193 45 for purple background
194 46 for cyan background
195 47 for white (or gray) background
196
197 Not all commands will work on all systems or display devices.
198
199 ls uses the following defaults:
200
201 NORMAL 0 Normal (nonfilename) text
202 FILE 0 Regular file
203 DIR 32 Directory
204 LINK 36 Symbolic link
205
206 ORPHAN undefined Orphaned symbolic link
207 MISSING undefined Missing file
208 FIFO 31 Named pipe (FIFO)
209 SOCK 33 Socket
210 BLK 44;37 Block device
211 CHR 44;37 Character device
212 EXEC 35 Executable file
213
214 A few terminal programs do not recognize the default properly. If all
215 text gets colorized after you do a directory listing, change the NORMAL
216 and FILE codes to the numerical codes for your normal foreground and
217 background colors.
218
219 Other terminal types (advanced configuration)
220 If you have a color-capable (or otherwise highlighting) terminal (or
221 printer!) which uses a different set of codes, you can still generate a
222 suitable setup. To do so, you will have to use the LEFTCODE, RIGHT‐
223 CODE, and ENDCODE definitions.
224
225 When writing out a filename, ls generates the following output
226 sequence: LEFTCODE typecode RIGHTCODE filename ENDCODE, where the type‐
227 code is the color sequence that depends on the type or name of file.
228 If the ENDCODE is undefined, the sequence LEFTCODE NORMAL RIGHTCODE
229 will be used instead. The purpose of the left- and rightcodes is
230 merely to reduce the amount of typing necessary (and to hide ugly
231 escape codes away from the user). If they are not appropriate for your
232 terminal, you can eliminate them by specifying the respective keyword
233 on a line by itself.
234
235 NOTE: If the ENDCODE is defined in the global section of the setup
236 file, it cannot be undefined in a terminal-specific section of the
237 file. This means any NORMAL definition will have no effect. A differ‐
238 ent ENDCODE can, however, be specified, which would have the same
239 effect.
240
241 Escape sequences
242 To specify control- or blank characters in the color sequences or file‐
243 name extensions, either C-style \-escaped notation or stty-style
244 ^-notation can be used. The C-style notation includes the following
245 characters:
246
247 \a Bell (ASCII 7)
248 \b Backspace (ASCII 8)
249 \e Escape (ASCII 27)
250 \f Form feed (ASCII 12)
251 \n Newline (ASCII 10)
252 \r Carriage Return (ASCII 13)
253 \t Tab (ASCII 9)
254 \v Vertical Tab (ASCII 11)
255 \? Delete (ASCII 127)
256 \nnn Any character (octal notation)
257 \xnnn Any character (hexadecimal notation)
258 \_ Space
259 \\ Backslash (\)
260 \^ Caret (^)
261 \# Hash mark (#)
262
263 Note that escapes are necessary to enter a space, backslash, caret, or
264 any control character anywhere in the string, as well as a hash mark as
265 the first character.
266
268 /etc/DIR_COLORS
269 System-wide configuration file.
270
271 ~/.dir_colors
272 Per-user configuration file.
273
274 This page describes the dir_colors file format as used in the fileu‐
275 tils-4.1 package; other versions may differ slightly.
276
278 The default LEFTCODE and RIGHTCODE definitions, which are used by ISO
279 6429 terminals are:
280
281 LEFTCODE \e[
282 RIGHTCODE m
283
284 The default ENDCODE is undefined.
285
287 dircolors(1), ls(1), stty(1), xterm(1)
288
290 This page is part of release 4.15 of the Linux man-pages project. A
291 description of the project, information about reporting bugs, and the
292 latest version of this page, can be found at
293 https://www.kernel.org/doc/man-pages/.
294
295
296
297GNU 2013-08-09 DIR_COLORS(5)