dir_colors(5)
๐ dir_colors(5) โ the file format manual, bestie edition ๐
okay so listen. this is dir_colors, section 5 of the File Formats Manual, and it's literally just the configuration file for dircolors(1). that's the whole vibe. let's get into it ๐
โจ NAME โจ
dir_colors โ configuration file for dircolors(1) ๐ฆ
๐ธ DESCRIPTION ๐ธ
so here's the tea: ls(1) looks at the environment variable LS_COLORS to figure out what colors to paint your filenames in. and that variable? usually set by a command like this one, bestie:
eval `dircolors some_path/dir_colors`
you'll find that line chilling in a system default shell initialization file, like /etc/profile or /etc/csh.cshrc. (also go read dircolors(1) while you're at it ๐
) usually the file used here is /etc/DIR_COLORS, and you can override it with a .dir_colors file in your home directory. main character energy, honestly.
this config file is made of several statements, one per line. anything to the right of a hash mark (#) counts as a comment โ but ONLY if the hash mark is at the very beginning of a line or has at least one whitespace before it. blank lines get ignored, no notes. ๐
the global section of the file is any statement before the first TERM statement. anything in the global section is valid for all terminal types. after the global section comes one or more terminal-specific sections, each introduced by one or more TERM statements that say which terminal types (as given by the TERM environment variable) the following declarations apply to. and get this โ you can always override a global declaration with a later terminal-specific one. slay. ๐
the following statements are recognized; case is insignificant:
TERMterminal-type โ starts a terminal-specific section and says which terminal it applies to. you can stack multipleTERMstatements to make a section that applies to several terminal types at once.COLORyes|all|no|none|ttyโ (Slackware only; ignored by GNUdircolors(1).) says colorization should always be on (yesorall), never on (noornone), or on only when the output is a terminal (tty). the default isno.EIGHTBITyes|noโ (Slackware only; ignored by GNUdircolors(1).) says eight-bit ISO/IEC 8859 characters should be enabled by default. for compatibility reasons you can also write it as1for yes or0for no. the default isno.OPTIONSoptions โ (Slackware only; ignored by GNUdircolors(1).) adds command-line options to the defaultlscommand line. the options can be any validlscommand-line options, and should include the leading minus sign. heads up:dircolorsdoes not verify that these options are valid. ๐NORMALcolor-sequence โ the color used for normal (nonfilename) text. synonym:NORM.FILEcolor-sequence โ the color used for a regular file.DIRcolor-sequence โ the color used for directories.LINKcolor-sequence โ the color used for a symbolic link. synonyms:LNK,SYMLINK.ORPHANcolor-sequence โ the color used for an orphaned symbolic link (one that points to a nonexistent file). if you don't specify this,lsjust uses theLINKcolor instead.MISSINGcolor-sequence โ the color used for a missing file (a nonexistent file that nevertheless has a symbolic link pointing to it). if you don't specify this,lsuses theFILEcolor instead.FIFOcolor-sequence โ the color used for a FIFO (named pipe). synonym:PIPE.SOCKcolor-sequence โ the color used for a socket.DOORcolor-sequence โ (supported since fileutils 4.1) the color used for a door (Solaris 2.5 and later).BLKcolor-sequence โ the color used for a block device special file. synonym:BLOCK.CHRcolor-sequence โ the color used for a character device special file. synonym:CHAR.EXECcolor-sequence โ the color used for a file with the executable attribute set.SUIDcolor-sequence โ the color used for a file with the set-user-ID attribute set. synonym:SETUID.SGIDcolor-sequence โ the color used for a file with the set-group-ID attribute set. synonym:SETGID.STICKYcolor-sequence โ the color used for a directory with the sticky attribute set.STICKY_OTHER_WRITABLEcolor-sequence โ the color used for an other-writable directory with the executable attribute set. synonym:OWT.OTHER_WRITABLEcolor-sequence โ the color used for an other-writable directory without the executable attribute set. synonym:OWR.LEFTCODEcolor-sequence โ the left code for non-ISO/IEC 6429 terminals (see below). synonym:LEFT.RIGHTCODEcolor-sequence โ the right code for non-ISO/IEC 6429 terminals (see below). synonym:RIGHT.ENDCODEcolor-sequence โ the end code for non-ISO/IEC 6429 terminals (see below). synonym:END.*extensioncolor-sequence โ the color used for any file that ends in extension..extensioncolor-sequence โ same as*.extension. the color used for any file that ends in.extension. note: the period is included in the extension, which makes it impossible to specify an extension that doesn't start with a period, like~for emacs backup files. this form should be considered obsolete. ๐ซ
๐ ISO/IEC 6429 (ANSI) color sequences ๐
most color-capable ASCII terminals these days use ISO/IEC 6429 (ANSI) color sequences, and lots of common terminals without color capability โ including xterm and the widely used and cloned DEC VT100 โ will recognize ISO/IEC 6429 color codes and harmlessly strip them out of the output, or emulate them. ls uses ISO/IEC 6429 codes by default, assuming colorization is enabled. โจ
ISO/IEC 6429 color sequences are built from sequences of numbers separated by semicolons. the most common codes are:
0โ to restore default color1โ for brighter colors4โ for underlined text5โ for flashing text30โ for black foreground31โ for red foreground32โ for green foreground33โ for yellow (or brown) foreground34โ for blue foreground35โ for purple foreground36โ for cyan foreground37โ for white (or gray) foreground40โ for black background41โ for red background42โ for green background43โ for yellow (or brown) background44โ for blue background45โ for purple background46โ for cyan background47โ for white (or gray) background
not all commands will work on all systems or display devices. no cap. ๐ญ
ls uses the following defaults:
NORMALโ0โ Normal (nonfilename) textFILEโ0โ Regular fileDIRโ32โ DirectoryLINKโ36โ Symbolic linkORPHANโundefinedโ Orphaned symbolic linkMISSINGโundefinedโ Missing fileFIFOโ31โ Named pipe (FIFO)SOCKโ33โ SocketBLKโ44;37โ Block deviceCHRโ44;37โ Character deviceEXECโ35โ Executable file
a few terminal programs don't recognize the default properly. if literally all your text gets colorized after you do a directory listing, change the NORMAL and FILE codes to the numerical codes for your normal foreground and background colors. easy fix, we love that for you. ๐
๐ง Other terminal types (advanced configuration) ๐ง
if you've got a color-capable (or otherwise highlighting) terminal (or printer!) that uses a different set of codes, you can still generate a suitable setup. to do that, you'll 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 typecode is the color sequence that depends on the type or name of the file. if ENDCODE is undefined, the sequence LEFTCODE NORMAL RIGHTCODE gets used instead. the whole point of the left- and rightcodes is just to cut down on how much typing you have to do (and to hide ugly escape codes away from the user). if they're not appropriate for your terminal, you can eliminate them by specifying the respective keyword on a line by itself.
NOTE: ifENDCODEis defined in the global section of the setup file, it can't be undefined in a terminal-specific section of the file. this means anyNORMALdefinition will have no effect. a differentENDCODEcan, however, be specified, which would have the same effect. ๐ฅ
๐ Escape sequences ๐
to specify control- or blank characters in the color sequences or filename extensions, you can use either C-style \-escaped notation or stty-style ^-notation. the C-style notation includes the following characters:
\aโ Bell (ASCII 7)\bโ Backspace (ASCII 8)\eโ Escape (ASCII 27)\fโ Form feed (ASCII 12)\nโ Newline (ASCII 10)\rโ Carriage Return (ASCII 13)\tโ Tab (ASCII 9)\vโ Vertical Tab (ASCII 11)\?โ Delete (ASCII 127)\nnnโ Any character (octal notation)\xnnnโ Any character (hexadecimal notation)\_โ Space\\โ Backslash (\)\^โ Caret (^)\#โ Hash mark (#)
note that escapes are necessary to enter a space, backslash, caret, or any control character anywhere in the string, as well as a hash mark as the first character. so likeโฆ don't forget them. ๐
๐ FILES ๐
/etc/DIR_COLORSโ System-wide configuration file.~/.dir_colorsโ Per-user configuration file.
this page describes the dir_colors file format as used in the fileutils-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 \e[
RIGHTCODE m
the default ENDCODE is undefined.
โญ SEE ALSO โญ
dircolors(1), ls(1), stty(1), xterm(1)
okay that's the whole page!! this was Linux man-pages 6.20, dated 2026-02-08 โ go forth and colorize your terminal, bestie, you're gonna eat ๐ โจ๐ฆ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-2.0-or-later
- Copyright 2001, Martin Schulze <joey@debian.org>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms