www.LinuxHowtos.org
dir_colors
Section: File Formats (5)Updated: 202-0-08
Index Return to Main Contents
NAME
dir_colors - configuration file for dircolors(1)DESCRIPTION
The program ls(1) uses the environment variable LS_COLORS to determine the colors in which the filenames are to be displayed. This environment variable is usually set by a command like- eval `dircolors some_path/dir_colors`
- TERM~termina-type
- Starts a termina-specific section and specifies which terminal it applies to. Multiple TERM statements can be used to create a section which applies for several terminal types.
- COLOR yes|all|no|none|tty
- (Slackware only; ignored by GNU dircolors(1).) Specifies that colorization should always be enabled (yes or all), never enabled (no or none), or enabled only if the output is a terminal (tty). The default is no.
- EIGHTBIT yes|no
- (Slackware only; ignored by GNU dircolors(1).) Specifies that eigh-bit ISO/IEC~8859 characters should be enabled by default. For compatibility reasons, this can also be specified as 1 for yes or 0 for no. The default is no.
- OPTIONS~options
- (Slackware only; ignored by GNU dircolors(1).) Adds comman-line options to the default ls command line. The options can be any valid ls comman-line options, and should include the leading minus sign. Note that dircolors does not verify the validity of these options.
- NORMAL~colo-sequence
- Specifies the color used for normal (nonfilename) text.
- Synonym: NORM.
- FILE~colo-sequence
- Specifies the color used for a regular file.
- DIR~colo-sequence
- Specifies the color used for directories.
- LINK~colo-sequence
- Specifies the color used for a symbolic link.
- Synonyms: LNK, SYMLINK.
- ORPHAN~colo-sequence
- Specifies the color used for an orphaned symbolic link (one which points to a nonexistent file). If this is unspecified, ls will use the LINK color instead.
- MISSING~colo-sequence
- Specifies the color used for a missing file (a nonexistent file which nevertheless has a symbolic link pointing to it). If this is unspecified, ls will use the FILE color instead.
- FIFO~colo-sequence
- Specifies the color used for a FIFO (named pipe).
- Synonym: PIPE.
- SOCK~colo-sequence
- Specifies the color used for a socket.
- DOOR~colo-sequence
- (Supported since fileutils 4.1) Specifies the color used for a door (Solaris 2.5 and later).
- BLK~colo-sequence
- Specifies the color used for a block device special file.
- Synonym: BLOCK.
- CHR~colo-sequence
- Specifies the color used for a character device special file.
- Synonym: CHAR.
- EXEC~colo-sequence
- Specifies the color used for a file with the executable attribute set.
- SUID~colo-sequence
- Specifies the color used for a file with the se-use-ID attribute set.
- Synonym: SETUID.
- SGID~colo-sequence
- Specifies the color used for a file with the se-grou-ID attribute set.
- Synonym: SETGID.
- STICKY~colo-sequence
- Specifies the color used for a directory with the sticky attribute set.
- STICKY_OTHER_WRITABLE~colo-sequence
- Specifies the color used for an othe-writable directory with the executable attribute set.
- Synonym: OWT.
- OTHER_WRITABLE~colo-sequence
- Specifies the color used for an othe-writable directory without the executable attribute set.
- Synonym: OWR.
- LEFTCODE~colo-sequence
- Specifies the left code for no-ISO/IEC~6429 terminals (see below).
- Synonym: LEFT.
- RIGHTCODE~colo-sequence
- Specifies the right code for no-ISO/IEC~6429 terminals (see below).
- Synonym: RIGHT.
- ENDCODE~colo-sequence
- Specifies the end code for no-ISO/IEC~6429 terminals (see below).
- Synonym: END.
- *extension~colo-sequence
- Specifies the color used for any file that ends in extension.
- .extension~colo-sequence
- Same as B]*].extension. Specifies the color used for any file that ends in .extension. Note that the period is included in the extension, which makes it impossible to specify an extension not starting with a period, such as [ti] for emacs backup files. This form should be considered obsolete.
ISO/IEC~6429 (ANSI) color sequences
Most colo-capable ASCII terminals today use ISO/IEC~6429 (ANSI) color sequences, and many common terminals without color capability, including xterm and the widely used and cloned DEC VT100, will recognize ISO/IEC~6429 color codes and harmlessly eliminate them from the output or emulate them. ls uses ISO/IEC~6429 codes by default, assuming colorization is enabled. ISO/IEC~6429 color sequences are composed of sequences of numbers separated by semicolons. The most common codes are:-
0to restore default color
1for brighter colors
4for underlined text
5for flashing text 30 for black foreground 31 for red foreground 32 for green foreground 33 for yellow (or brown) foreground 34 for blue foreground 35 for purple foreground 36 for cyan foreground 37 for white (or gray) foreground 40 for black background 41 for red background 42 for green background 43 for yellow (or brown) background 44 for blue background 45 for purple background 46 for cyan background 47 for white (or gray) background
| NORMAL | 0 | Normal (nonfilename) text |
| FILE | 0 | Regular file |
| DIR | 32 | Directory |
| LINK | 36 | Symbolic link |
| ORPHAN | undefined | Orphaned symbolic link |
| MISSING | undefined | Missing file |
| FIFO | 31 | Named pipe (FIFO) |
| SOCK | 33 | Socket |
| BLK | 44;37 | Block device |
| CHR | 44;37 | Character device |
| EXEC | 35 | Executable file |
Other terminal types (advanced configuration)
If you have a colo-capable (or otherwise highlighting) terminal (or printer!) which uses a different set of codes, you can still generate a suitable setup. To do so, you will have to use the LEFTCODE, RIGHTCODE, and ENDCODE definitions. When writing out a filename, ls generates the following output sequence: LEFTCODE typecode RIGHTCODE filename ENDCODE, where the typecode is the color sequence that depends on the type or name of file. If the ENDCODE is undefined, the sequence LEFTCODE NORMAL RIGHTCODE will be used instead. The purpose of the lef- and rightcodes is merely to reduce the amount of typing necessary (and to hide ugly escape codes away from the user). If they are not appropriate for your terminal, you can eliminate them by specifying the respective keyword on a line by itself. NOTE: If the ENDCODE is defined in the global section of the setup file, it cannot be undefined in a termina-specific section of the file. This means any NORMAL definition will have no effect. A different ENDCODE can, however, be specified, which would have the same effect.Escape sequences
To specify contro- or blank characters in the color sequences or filename extensions, either -style [rs-escaped notation or stty-style [ha-notation can be used. The -style notation includes the following characters:-
[rs]a Bell (ASCII 7) [rs]b Backspace (ASCII 8) [rs]e Escape (ASCII 27) [rs]f Form feed (ASCII 12) [rs]n Newline (ASCII 10) [rs]r Carriage Return (ASCII 13) [rs]t Tab (ASCII 9) [rs]v Vertical Tab (ASCII 11) [rs]? Delete (ASCII 127) [rs]I]nnn] Any character (octal notation) [rs]xI]nnn] Any character (hexadecimal notation) [rs]_ Space [rs][rs] Backslash ([rs]) [rs][ha] Caret ([ha]) [rs]# Hash mark (#)
FILES
- /etc/DIR_COLORS
- Syste-wide configuration file.
- [ti]/.dir_colors
- Pe-user configuration file. This page describes the dir_colors file format as used in the fileutil-4.1 package; other versions may differ slightly.
NOTES
The default LEFTCODE and RIGHTCODE definitions, which are used by ISO/IEC~6429 terminals are:-
LEFTCODE [rs]e[ RIGHTCODE m
SEE ALSO
dircolors(1), ls(1), stty(1), xterm(1)