Skip to content

Commit ee7c362

Browse files
authored
Add description of default sorting behavior to zfs_list.8
The sorting logic is all in cmd/zfs/zfs_iter.c. I borrowed where I could from the comments in the source code, but please note that the comment to zfs_sort() is a little imprecise, or at least incomplete, because it doesn't give any indication of the chronological sort that will be used by default for snapshots in zfs_compare(). While adding this description, I took the liberty to copy-edit the rest of the file lightly. In those edits, I've removed "If specified, you can list property information by the absolute pathname or the relative pathname" because, in context, it seems more confusing than helpful. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Shawn Bayern <[email protected]> Closes #15713 Closes #15869
1 parent 14bad10 commit ee7c362

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

man/man8/zfs-list.8

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,25 @@
5050
.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns
5151
.
5252
.Sh DESCRIPTION
53-
If specified, you can list property information by the absolute pathname or the
54-
relative pathname.
55-
By default, all file systems and volumes are displayed.
53+
By default, all file systems and volumes are displayed, with the following
54+
fields:
55+
.Sy name , Sy used , Sy available , Sy referenced , Sy mountpoint .
5656
Snapshots are displayed if the
5757
.Sy listsnapshots
5858
pool property is
5959
.Sy on
6060
.Po the default is
6161
.Sy off
62-
.Pc ,
62+
.Pc
6363
or if the
6464
.Fl t Sy snapshot
6565
or
6666
.Fl t Sy all
6767
options are specified.
68-
The following fields are displayed:
69-
.Sy name , Sy used , Sy available , Sy referenced , Sy mountpoint .
7068
.Bl -tag -width "-H"
7169
.It Fl H
7270
Used for scripting mode.
73-
Do not print headers and separate fields by a single tab instead of arbitrary
71+
Do not print headers, and separate fields by a single tab instead of arbitrary
7472
white space.
7573
.It Fl j , -json Op Ar --json-int
7674
Print the output in JSON format.
@@ -87,7 +85,7 @@ of
8785
will display only the dataset and its direct children.
8886
.It Fl o Ar property
8987
A comma-separated list of properties to display.
90-
The property must be:
88+
Each property must be:
9189
.Bl -bullet -compact
9290
.It
9391
One of the properties described in the
@@ -125,30 +123,41 @@ section of
125123
or the value
126124
.Sy name
127125
to sort by the dataset name.
128-
Multiple properties can be specified at one time using multiple
126+
Multiple properties can be specified to operate together using multiple
129127
.Fl s
130-
property options.
128+
or
129+
.Fl S
130+
options.
131131
Multiple
132132
.Fl s
133-
options are evaluated from left to right in decreasing order of importance.
134-
The following is a list of sorting criteria:
133+
and
134+
.Fl S
135+
options are evaluated from left to right to supply sort keys in
136+
decreasing order of priority.
137+
Property types operate as follows:
135138
.Bl -bullet -compact
136139
.It
137140
Numeric types sort in numeric order.
138141
.It
139142
String types sort in alphabetical order.
140143
.It
141-
Types inappropriate for a row sort that row to the literal bottom, regardless of
142-
the specified ordering.
144+
Types inappropriate for a row sort that row to the literal bottom,
145+
regardless of the specified ordering.
143146
.El
144147
.Pp
145-
If no sorting options are specified the existing behavior of
146-
.Nm zfs Cm list
147-
is preserved.
148+
If no sort columns are specified, or if two lines of output would sort
149+
equally across all specified columns, then datasets and bookmarks are
150+
sorted by name, whereas snapshots are sorted first by the name of their
151+
dataset and then by the time of their creation.
152+
When no sort columns are specified but snapshots are listed, this
153+
default behavior causes snapshots to be grouped under their datasets in
154+
chronological order by creation time.
148155
.It Fl S Ar property
149156
Same as
150157
.Fl s ,
151-
but sorts by property in descending order.
158+
but sorts by
159+
.Ar property
160+
in descending order.
152161
.It Fl t Ar type
153162
A comma-separated list of types to display, where
154163
.Ar type

0 commit comments

Comments
 (0)