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 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
133 0 to restore default color
134 1 for brighter colors
135 4 for underlined text
136
137 5 for flashing text
138 30 for black foreground
139 31 for red foreground
140 32 for green foreground
141 33 for yellow (or brown) foreground
142 34 for blue foreground
143 35 for purple foreground
144 36 for cyan foreground
145 37 for white (or gray) foreground
146 40 for black background
147 41 for red background
148 42 for green background
149 43 for yellow (or brown) background
150 44 for blue background
151 45 for purple background
152 46 for cyan background
153 47 for white (or gray) background
154
155 Not all commands will work on all systems or display devices.
156
157 ls uses the following defaults:
158
159
160 NORMAL 0 Normal (nonfilename) text
161 FILE 0 Regular file
162 DIR 32 Directory
163 LINK 36 Symbolic link
164 ORPHAN undefined Orphaned symbolic link
165 MISSING undefined Missing file
166 FIFO 31 Named pipe (FIFO)
167 SOCK 33 Socket
168 BLK 44;37 Block device
169 CHR 44;37 Character device
170 EXEC 35 Executable file
171
172 A few terminal programs do not recognize the default properly. If all
173 text gets colorized after you do a directory listing, change the NORMAL
174 and FILE codes to the numerical codes for your normal foreground and
175 background colors.
176
177 Other terminal types (advanced configuration)
178 If you have a color-capable (or otherwise highlighting) terminal (or
179 printer!) which uses a different set of codes, you can still generate a
180 suitable setup. To do so, you will have to use the LEFTCODE, RIGHT‐
181 CODE, and ENDCODE definitions.
182
183 When writing out a filename, ls generates the following output
184 sequence: LEFTCODE typecode RIGHTCODE filename ENDCODE, where the type‐
185 code is the color sequence that depends on the type or name of file.
186 If the ENDCODE is undefined, the sequence LEFTCODE NORMAL RIGHTCODE
187 will be used instead. The purpose of the left- and rightcodes is
188 merely to reduce the amount of typing necessary (and to hide ugly
189 escape codes away from the user). If they are not appropriate for your
190 terminal, you can eliminate them by specifying the respective keyword
191 on a line by itself.
192
193 NOTE: If the ENDCODE is defined in the global section of the setup
194 file, it cannot be undefined in a terminal-specific section of the
195 file. This means any NORMAL definition will have no effect. A differ‐
196 ent ENDCODE can, however, be specified, which would have the same
197 effect.
198
199 Escape sequences
200 To specify control- or blank characters in the color sequences or file‐
201 name extensions, either C-style \-escaped notation or stty-style
202 ^-notation can be used. The C-style notation includes the following
203 characters:
204
205
206 \a Bell (ASCII 7)
207 \b Backspace (ASCII 8)
208 \e Escape (ASCII 27)
209 \f Form feed (ASCII 12)
210 \n Newline (ASCII 10)
211 \r Carriage Return (ASCII 13)
212 \t Tab (ASCII 9)
213 \v Vertical Tab (ASCII 11)
214 \? Delete (ASCII 127)
215 \nnn Any character (octal notation)
216 \xnnn Any character (hexadecimal notation)
217 \_ Space
218 \\ Backslash (\)
219 \^ Caret (^)
220 \# Hash mark (#)
221
222 Please note that escapes are necessary to enter a space, backslash,
223 caret, or any control character anywhere in the string, as well as a
224 hash mark as the first character.
225
227 /etc/DIR_COLORS
228 System-wide configuration file.
229
230 ~/.dir_colors
231 Per-user configuration file.
232
233 This page describes the dir_colors file format as used in the fileu‐
234 tils-4.1 package; other versions may differ slightly.
235
237 The default LEFTCODE and RIGHTCODE definitions, which are used by ISO
238 6429 terminals are:
239
240
241 LEFTCODE \e[
242 RIGHTCODE m
243
244 The default ENDCODE is undefined.
245
247 dircolors(1), ls(1), stty(1), xterm(1)
248
250 This page is part of release 3.53 of the Linux man-pages project. A
251 description of the project, and information about reporting bugs, can
252 be found at http://www.kernel.org/doc/man-pages/.
253
254
255
256GNU 2001-12-26 DIR_COLORS(5)