1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
$NetBSD: patch-ab,v 1.4 1998/08/07 11:10:12 agc Exp $
--- colorls.1.orig Thu May 21 15:42:07 1998
+++ colorls.1 Thu May 21 15:42:09 1998
@@ -36,16 +36,24 @@
.\" Id: patch-ab,v 1.3 1998/05/21 14:06:37 frueauf Exp
.\"
.Dd July 29, 1994
-.Dt LS 1
+.Dt COLORLS 1
.Os
.Sh NAME
-.Nm ls
-.Nd list directory contents
+.Nm colorls
+.Nd list directory contents in color
.Sh SYNOPSIS
-.Nm ls
-.Op Fl ACFLRTWacdfiloqrstu1
+.Nm colorls
+.Op Fl ACFGLRTWacdfiloqrstu1
.Op Ar file ...
.Sh DESCRIPTION
+(Note: This man page describes the color version of the program. To
+minimize the differences from the original, the program is referred to
+as
+.Nm ls
+in this manual. The new option
+.Fl G
+is for color display.)
+.Pp
For each operand that names a
.Ar file
of a type other than
@@ -87,6 +95,12 @@
a percent sign (%) after each whiteout,
and a vertical bar (|) after each that is a
.Tn FIFO .
+.It Fl G
+Use ANSI color sequences to distinguish file types. (See
+.Ev LSCOLORS
+below.) In addition to those mentioned above in
+.Fl F ,
+some extra attributes (setuid bit set, etc.) are also displayed.
.It Fl L
If argument is a symbolic link, list the file or directory the link references
rather than the link itself.
@@ -318,6 +332,74 @@
See
.Xr environ 7
for more information.
+.It LSCOLORS
+The value of this variable describes what color to use for which
+attribute when the color output
+.Pq Fl G
+is specified. This string is a concatenation of pairs of the format
+.Sy fb ,
+where
+.Sy f
+is the foreground color and
+.Sy b
+is the background color.
+.Pp
+The color designators are as follows:
+.Pp
+.Bl -tag -width 4n -offset indent -compact
+.It Sy 0
+black
+.It Sy 1
+red
+.It Sy 2
+green
+.It Sy 3
+yellow
+.It Sy 4
+blue
+.It Sy 5
+magenta
+.It Sy 6
+cyan
+.It Sy 7
+white
+.It Sy x
+default foreground or background
+.El
+.Pp
+(Note: the above are standard ANSI colors. The actual display may
+differ depending on the color capabilities of your terminal.)
+.Pp
+The order of the attributes are as follows:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+directory
+.It
+symbolic link
+.It
+socket
+.It
+pipe
+.It
+executable
+.It
+block special
+.It
+character special
+.It
+executable with setuid bit set
+.It
+executable with setgid bit set
+.It
+directory writable to others, with sticky bit
+.It
+directory writable to others, without sticky bit
+.El
+.Pp
+The default is "4x5x2x3x1x464301060203", i.e., blue foreground and
+default background for regular directories, black foreground and red
+background for setuid executables, etc.
.El
.Sh COMPATIBILITY
The group field is now automatically included in the long listing for
|