DIR_COLORS(5) Linux User Manual DIR_COLORS(5) 名前 dir_colors - dircolors(1) の設定ファイル 説明 プ ログラム ls(1) は、環境変数 LS_COLORS を使い、ファイル名を何色で表示 するかを決定する。この環境変数は、通常 eval `dircolors some_path/dir_colors` のようなコマンドで設定される 。 こ の コ マ ン ド は /etc/profile や /etc/csh.cshrc といったシステムのシェル初期化ファイルにある。 (dircol- ors(1) を参照すること。) 通常、ここで使われるファイルは /etc/DIR_COLORS であるが、ホームディレクトリの .dir_colors ファイルで上書きすることがで きる。 設定ファイルは 1 行毎に書かれたステートメントで構成される。ハッシュマー ク (#) が行の始めにある場合や、ハッシュマークの前に少なくとも 1 つの空 白がある場合、ハッシュマークの後ろはコメントとして扱われる。空行は無 視 される。 このファイルの グローバルセクションは、最初の TERM ステートメントより前 にある任意のステートメントからなる。グローバルセクションにあるステー ト メ ントは、すべての端末タイプについて有効であるとみなされる。グローバル セクションの次には、 端末固有セクションが続く。各端末固有セクションの先 頭 には、1 つ以上の TERM ステートメントが置かれる。 TERM ステートメント は、その後に続く宣言が適用される (環境変数 TERM で与えられる) 端末タ イ プ を指定する。グローバル宣言をその後に続く端末固有の宣言で上書きするこ とが常に可能である。 次のステートメントが認識される。大文字と小文字は区別されない。 TERM terminal-type 端末固有セクションを開始し、どの端末に適用するかを指定する。複数 の端末タイプに適用するため、複数の TERM ステートメントを使うこと ができる。 COLOR yes|all|no|none|tty (Slackware のみ; GNU dircolors(1) では無視される。) カラー表示を 常に有効にするのか (yes または all)、常に無効にするのか (no また は none)、出力先が端末の場合にのみ有効にするのか (tty) を指定 す る。デフォルトは no である。 EIGHTBIT yes|no (Slackware のみ; GNU dircolors(1) では無視される。) デフォルトで 8 ビットの ISO 8859 文字を有効にするかを指定する。互換性の た め 、1 で yes を、0 で no を指定することができる。デフォルトは no である。 OPTIONS options (Slackware のみ; GNU dircolors(1) では無視される。) コマンドライ ンオプションをデフォルトの ls コマンドラインに追加する。このオプ ションには、すべての有効な ls のコマンドラインオプションを指定で き る 。 オ プションの前にはマイナス記号を置かなければならない。 dircolors がオプションの有効性を検証しない点に注意すること。 NORMAL color-sequence (ファイル名でない) 通常のテキストに使われる色を指定する。 FILE color-sequence 通常のファイルに使われる色を指定する。 DIR color-sequence ディレクトリに使われる色を指定する。 LINK color-sequence シンボリックリンクに使われる色を指定する。 ORPHAN color-sequence 孤立した (存在しないファイルを指している) シンボリックリンクに使 われる色を指定する。指定されない場合、 ls は LINK の色を代わりに 使う。 MISSING color-sequence 行方不明のファイル (存在しないにもかかわらずシンボリックリンクが 指 し ているファイル) に使われる色を指定する。指定されない場合、 ls は FILE の色を代わりに使う。 FIFO color-sequence FIFO (名前付きパイプ) に使われる色を指定する。 SOCK color-sequence ソケットに使われる色を指定する。 DOOR color-sequence (fileutils 4.1 以降でサポートされる) door (Solaris 2.5 以降) で 使われる色を指定する。 BLK color-sequence ブロックデバイススペシャルファイルに使われる色を指定する。 CHR color-sequence キャラクターデバイススペシャルファイルに使われる色を指定する。 EXEC color-sequence 実行属性が設定されているファイルに使われる色を設定する。 LEFTCODE color-sequence ISO 6429 端末 (下記参照) 以外で left code に使われる色を指定する 。 RIGHTCODE color-sequence ISO 6429 端末 (下記参照) 以外で right code に使われる色を指定 す る。 ENDCODE color-sequence ISO 6429 端末 (下記参照) 以外で end code に使われる色を指定する 。 *extension color-sequence extension で終るすべてのファイルに使われる色を指定する。 .extension color-sequence *.extension と同じ。 extension で終るすべてのファイルに使われ る 色 を指定する。ピリオドは拡張子に含まれ、 emacs のバックアップフ ァイル ~ のようなピリオドで始まらない拡張子を指定することがで き ない点に注意すること。この形式は古いものと考えられている。 ISO 6429 (ANSI) カラーシーケンス 最 近のカラー表示可能な ASCII 端末の大部分は、 ISO 6429 (ANSI) カラーシ ーケンスを用いる。 xterm や広く使われている DEC VT100 クローンを含む カ ラ ー表示できない一般的な端末の多くは、 ISO 6429 カラーコードを認識し、 出力から実害なく削除するか、エミュレートする。 ls は、カラー表示が有 効 であることを仮定し、ISO 6429 コードをデフォルトで使う。 ISO 6429 カラーシーケンスは、セミコロンで区切られた数字のシーケンスで作 られる。最も一般的なコードを示す。 0 デフォルトカラーを保存 1 明るい色 4 アンダーラインされたテキスト 5 フラッシュするテキスト 30 前景色:黒 31 前景色:赤 32 前景色:緑 33 前景色:黄 (もしくは茶) 34 前景色:青 35 前景色:紫 36 前景色:シアン 37 前景色:白 (もしくは灰) 40 背景色:黒 41 背景色:赤 42 背景色:緑 43 背景色:黄 (もしくは茶) 44 背景色:青 45 背景色:紫 46 背景色:シアン 47 背景色:白 (もしくは灰) システムと表示デバイスによっては、動作しないコマンドもある。 ls は以下をデフォルトとして使う。 NORMAL 0 (ファイル名でない) 通常のテキスト FILE 0 通常のファイル DIR 32 ディレクトリ LINK 36 シンボリックリンク ORPHAN 未定義 孤立したシンボリックリンク MISSING 未定義 行方不明のファイル FIFO 31 名前付きパイプ (FIFO) SOCK 33 ソケット BLK 44;37 ブロックデバイス CHR 44;37 キャラクターデバイス EXEC 35 実行ファイル デフォルトの設定を完全に認識できない端末プログラムも少数存在する。デ ィ レクトリをリストした後にすべてのテキストがカラー表示されたなら、 NORMAL と FILE のコードを通常の前景色と背景色のための数値コードに変更するこ と 。 その他の端末タイプ (高度な設定) カ ラー表示可能 (またはハイライト表示可能) だが、異なるコードセットを使 う端末 (あるいはプリンター!) を持っている場合でも、それに適した設定を作 る ことができる。そのためには、 LEFTCODE, RIGHTCODE, ENDCODE 定義を使う 必要がある。 ファイル名を出力する場合、 ls は " LEFTCODE typecode RIGHTCODE filename ENDCODE " という出力シーケンスを生成する。ここで、 typecode はファイル のタイプや名前に依存したカラーシーケンスである。 ENDCODE が未定義の場合 、シーケンス LEFTCODE NORMAL RIGHTCODE が代わりに使われる。 leftcode と rightcode の目的は、単に必要な打ち込む回数を減らす (さらに、見苦しい エ ス ケープコードをユーザーに隠す) ことにある。シーケンスがその端末にとっ て適切でない場合、行内のそれぞれのキーワード自身を指定して削除するこ と ができる。 注意: ENDCODE が設定ファイルのグローバルセクションで定義されている場合 、ファイルの端末固有セクションで未定義にすることは できない。これ は 、 NORMAL の 定 義が何も影響を及ぼさないことを意味する。しかし、異なった ENDCODE を指定することで同じ効果を得ることができる。 エスケープシーケンス カラーシーケンスやファイル名の拡張子で制御文字やブランク文字を指定す る ために、 C 言語スタイルの \ エスケープ表記と stty スタイルの ^ 表記の両 方を使うことができる。 C 言語スタイルの表記には以下の文字が含まれる。 \a ベル (ASCII 7) \b バックスペース (ASCII 8) \e エスケープ (ASCII 27) \f フォームフィード (ASCII 12) \n 改行 (ASCII 10) \r キャリッジリターン (ASCII 13) \t タブ (ASCII 9) \v 垂直タブ (ASCII 11) \? デリート (ASCII 127) \nnn (8 進数表記の) 任意の文字 \xnnn (16 進数表記の) 任意の文字 \_ スペース \\ バックスラッシュ (\) \^ キャレット (^) \# ハッシュマーク (#) ハッシュマークを始めの文字として入力するときと同様に、スペース・バッ ク ス ラッシュ・キャレット・制御文字を文字列の任意の部分に入力するためには 、エスケープが必要であることに注意すること。 ファイル /etc/DIR_COLORS システム全体の設定ファイル。 ~/.dir_colors ユーザー毎の設定ファイル。 注意 このページは fileutils-4.1 パッケージで使われている dir_colors のファイ ル 形式について説明している。その他のバージョンでは少し違いがあるかも知 れない。 ISO 6429 端末で使われる LEFTCODE と RIGHTCODE のデフォルトの定義は、 次 のようになっている。 LEFTCODE \e[ RIGHTCODE m ENDCODE のデフォルトは定義されていない。 関連項目 dircolors(1), ls(1), stty(1), xterm(1) GNU 2001-12-26 DIR_COLORS(5)
DIR_COLORS(5) Linux User Manual DIR_COLORS(5) 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 environ- ment variable is usually set by a command like eval `dircolors some_path/dir_colors` found in a system default shell initialization file, like /etc/profile or /etc/csh.cshrc. (See also dircolors(1).) Usually, the file used here is /etc/DIR_COLORS and can be overridden by a .dir_colors file in one’s home directory. This configuration file consists of several statements, one per line. Anything right of a hash mark (#) is treated as a comment, if the hash mark is at the beginning of a line or is preceded by at least one whitespace. Blank lines are ignored. The global section of the file consists of any statement before the first TERM statement. Any statement in the global section of the file is considered valid for all terminal types. Following the global sec- tion is one or more terminal-specific sections, preceded by one or more TERM statements which specify the terminal types (as given by the TERM environment variable) the following declarations apply to. It is always possible to override a global declaration by a subsequent termi- nal-specific one. The following statements are recognized; case is insignificant: TERM terminal-type Starts a terminal-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 termi- nal (tty). The default is no. EIGHTBIT yes|no (Slackware only; ignored by GNU dircolors(1).) Specifies that eight-bit ISO 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 command- line options to the default ls command line. The options can be any valid ls command-line options, and should include the lead- ing minus sign. Note that dircolors does not verify the valid- ity of these options. NORMAL color-sequence Specifies the color used for normal (non-filename) text. FILE color-sequence Specifies the color used for a regular file. DIR color-sequence Specifies the color used for directories. LINK color-sequence Specifies the color used for a symbolic link. ORPHAN color-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 color-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 color-sequence Specifies the color used for a FIFO (named pipe). SOCK color-sequence Specifies the color used for a socket. DOOR color-sequence (Supported since fileutils 4.1) Specifies the color used for a door (Solaris 2.5 and later). BLK color-sequence Specifies the color used for a block device special file. CHR color-sequence Specifies the color used for a character device special file. EXEC color-sequence Specifies the color used for a file with the executable attribute set. LEFTCODE color-sequence Specifies the left code for non-ISO 6429 terminals (see below). RIGHTCODE color-sequence Specifies the right code for non-ISO 6429 terminals (see below). ENDCODE color-sequence Specifies the end code for non-ISO 6429 terminals (see below). *extension color-sequence Specifies the color used for any file that ends in extension. .extension color-sequence Same as *.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 ~ for emacs backup files. This form should be considered obsolete. ISO 6429 (ANSI) Color Sequences Most color-capable ASCII terminals today use ISO 6429 (ANSI) color sequences, and many common terminals without color capability, includ- ing xterm and the widely used and cloned DEC VT100, will recognize ISO 6429 color codes and harmlessly eliminate them from the output or emu- late them. ls uses ISO 6429 codes by default, assuming colorization is enabled. ISO 6429 color sequences are composed of sequences of numbers separated by semicolons. The most common codes are: 0 to restore default color 1 for brighter colors 4 for underlined text 5 for 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 Not all commands will work on all systems or display devices. ls uses the following defaults: NORMAL 0 Normal (non-filename) 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 A few terminal programs do not recognize the default properly. If all 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. Other Terminal Types (Advanced Configuration) If you have a color-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, RIGHT- CODE, and ENDCODE definitions. When writing out a filename, ls generates the following output sequence: LEFTCODE typecode RIGHTCODE filename ENDCODE, where the type- code 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 left- 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 terminal-specific section of the file. This means any NORMAL definition will have no effect. A differ- ent ENDCODE can, however, be specified, which would have the same effect. Escape Sequences To specify control- or blank characters in the color sequences or file- name extensions, either C-style \-escaped notation or stty-style ^-notation can be used. 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 (#) Please 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. 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 fileu- tils-4.1 package; other versions may differ slightly. NOTES The default LEFTCODE and RIGHTCODE definitions, which are used by ISO 6429 terminals are: LEFTCODE \e[ RIGHTCODE m The default ENDCODE is undefined. SEE ALSO dircolors(1), ls(1), stty(1), xterm(1) COLOPHON This page is part of release 3.22 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU 2001-12-26 DIR_COLORS(5)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa