DIRCOLORS(1) General Commands Manual Fully-rendered PDF

dircolorsprepare colourisation for ls(1)

eval "$(dircolors [-b] [database])" (sh(1)-style shells)
eval  "`dircolors [-c] [database]`" (csh(1)-like shells)

dircolors -D [LS_COLORS] > database
dircolors -p

Writes a shell snippet setting LS_COLORS to the standard output stream. When evalled, subsequent ls --color runs will produce coloured output.

The colours embedded into LS_COLORS are determined by the database (standard input stream if "-"). One was inlined into this dircolors, and will be used if an explicit one isn't specified. See below or -p.

-D turns LS_COLORS into a database on the standard output stream, for subsequent editing. If it's a teletype, colours are reproduced.

, --sh, --bourne-shell
Produce LS_COLORS='…'; export LS_COLORS
, --csh, --c-shell
Produce setenv LS_COLORS '…'

, --print-ls-colors
Parse LS_COLORS into a database to the standard output stream.

, --print-database
Copy the built-in database to the standard output stream.

Without -bc, the default is -c if SHELL contains "csh", otherwise -b.
Parsed for -D if LS_COLORS wasn't specified.

# voreutils dircolors database
# 	eval "$(dircolors)"
#
# Columns are separated with tabs
# (Except in the first sexion) the first column is the escape value
# Subsequent columns are symbolic names that should use this escape value, as found in ls(1), ENVIRONMENT
# For clarity, all normal escapes are laid out vertically, but
#	40;33;01	bd	cd
# would've been equally valid and equivalent
#
# Comments are removed (and started with <tab>#)
# Blank lines and lines starting with #es are removed

#		lc	# escape start	(defaults to escape[)
#		rc	# escape end	(defaults to m)
#		ec	# reset (full)	(defaults to {lc}{rs}{rc})
0		rs	# reset

30;42		tw	# directory	(o+wt)		(green background, black text)
37;44		st	# directory	(o+t)		(blue  background, white text)
34;42		ow	# directory	(o+w)		(green background, blue  text)
01;34		di	# directory	(default)	(blue text, bold)

40;33;01	bd	# block device			(yellow text, bold)
40;33;01	cd	# character device
40;33		pi	# pipe (FIFO)			(yellow text)
01;35		so	# socket			(pink   text, bold)
01;35		do	# door

01;36		ln	# symbolic link	(default)	(teal text, bold)
40;31;01	or	# symbolic link	(dangling)	(red  text, bold)
00		mi	# dangling symbolic link target (unset/all-0s to copy dangling symbolic link)

37;41		su	# regular file	(u+s)		(red    background, white text)
30;43		sg	# regular file	(g+s)		(yellow background, black text)
01;32		ex	# regular file	(executable)	(green text, bold)
#		mh	# regular file	(st_nlink>1) (unset/all-0s to ignore)
#		fi	# regular file	(nonexecutable)

#		no	# normal text	(also default for regular files)

# non-executable regular files whose names case-insensitively fnmatch(3) the expressions
# backups:	grey text
00;90	*#	*.bak	*.dpkg-dist	*.dpkg-old	*.old	*.orig	*.part	*.rej	*.rpmnew	*.rpmorig	*.rpmsave	*.swp	*.tmp	*.ucf-dist	*.ucf-new	*.ucf-old	*~
# compressed:	red text, bold
01;31	*.7z	*.ace	*.alz	*.arc	*.arj	*.br	*.bz	*.bz2	*.cab	*.cpio	*.deb	*.dwm	*.dz	*.ear	*.esd	*.gz	*.jar	*.lha	*.lrz	*.lz	*.lz4	*.lzh	*.lzma	*.lzo	*.rar	*.rpm	*.rz	*.sar	*.swm	*.sz	*.tar	*.taz	*.tbz	*.tbz2	*.tgz	*.tlz	*.txz	*.tz	*.tzo	*.tzst	*.war	*.wim	*.xz	*.z	*.zip	*.zst
# audio:	teal text, dim
00;36	*.aac	*.au	*.flac	*.m4a	*.mid	*.midi	*.mka	*.mp3	*.mpc	*.oga	*.ogg	*.opus	*.pls	*.spx	*.wav	*.xspf
# video, image:	pink text, bold
01;35	*.asf	*.avi	*.avif	*.bmp	*.cgm	*.dl	*.emf	*.flc	*.fli	*.flv	*.gif	*.gifv	*.gl	*.heif	*.hevc	*.jpeg	*.jpg	*.m2v	*.m4v	*.mjpeg	*.mjpg	*.mkv	*.mng	*.mov	*.mp4	*.mp4v	*.mpeg	*.mpg	*.nuv	*.ogm	*.ogv	*.ogx	*.pbm	*.pcx	*.pgm	*.png	*.ppm	*.qt	*.rm	*.rmvb	*.svg	*.svgz	*.tga	*.tif	*.tiff	*.vob	*.webm	*.webp	*.wmv	*.xbm	*.xcf	*.xpm	*.xwd	*.yuv

ls(1)

Compatible with the GNU system (this implementation's database format is unrelated). Its --print-ls-colors doesn't actually reconstruct a database. The -D spelling is an extension.

July 12, 2024 voreutils 5a9f9f29