.dir_colorsでlsの視認性アップ

今まで、使ってなかったことを後悔した。orz


端末の背景色は、黒にすることがほとんどなので、
ディレクトリ名が青色で表示されて、見難くて、
要らないと思っていたLS_COLORSだけども、


ホームディレクトリに.dir_colorsファイルを作成して、
ユーザ毎にカスタマイズできるので、かなり便利だ!ということがわかった。


システム用のものが、
/etc/DIR_COLORS
にあるので、これをコピーし、各自で編集すればOK。


設定対象の後にスペースをおき、パラメータで動作を指定。
複数個指定する場合は、セミコロンを。


例えば、ディレクトリの場合、


DIR 01;34 # directory


で、明るい(01)青色(34)で表示する。


各パラメータについては、man dir_colorsを参照。
以下、抜粋。


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


アプリケーション特有の拡張子などがあれば、
適宜設定することで、lsの出力結果が抜群に見やすくなる。