xref: /freebsd/sys/contrib/openzfs/man/man8/zfs-list.8 (revision 3877025f52ee205fe99ad4ff68229933d57e4bcb)
1.\" SPDX-License-Identifier: CDDL-1.0
2.\"
3.\" CDDL HEADER START
4.\"
5.\" The contents of this file are subject to the terms of the
6.\" Common Development and Distribution License (the "License").
7.\" You may not use this file except in compliance with the License.
8.\"
9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10.\" or https://opensource.org/licenses/CDDL-1.0.
11.\" See the License for the specific language governing permissions
12.\" and limitations under the License.
13.\"
14.\" When distributing Covered Code, include this CDDL HEADER in each
15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16.\" If applicable, add the following below this CDDL HEADER, with the
17.\" fields enclosed by brackets "[]" replaced with your own identifying
18.\" information: Portions Copyright [yyyy] [name of copyright owner]
19.\"
20.\" CDDL HEADER END
21.\"
22.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
23.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
24.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
25.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
26.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
27.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
28.\" Copyright (c) 2014 Integros [integros.com]
29.\" Copyright 2019 Richard Laager. All rights reserved.
30.\" Copyright 2018 Nexenta Systems, Inc.
31.\" Copyright 2019 Joyent, Inc.
32.\"
33.Dd August 25, 2025
34.Dt ZFS-LIST 8
35.Os
36.
37.Sh NAME
38.Nm zfs-list
39.Nd list properties of ZFS datasets
40.Sh SYNOPSIS
41.Nm zfs
42.Cm list
43.Op Fl r Ns | Ns Fl d Ar depth
44.Op Fl Hp
45.Op Fl j Op Ar --json-int
46.Oo Fl o Ar property Ns Oo , Ns Ar property Oc Ns … Oc
47.Oo Fl s Ar property Oc Ns …
48.Oo Fl S Ar property Oc Ns …
49.Oo Fl t Ar type Ns Oo , Ns Ar type Oc Ns … Oc
50.Oo Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Oc Ns …
51.
52.Sh DESCRIPTION
53By default, all file systems and volumes are displayed, with the following
54fields:
55.Sy name , Sy used , Sy available , Sy referenced , Sy mountpoint .
56Snapshots are displayed if the
57.Sy listsnapshots
58pool property is
59.Sy on
60.Po the default is
61.Sy off
62.Pc
63or if the
64.Fl t Sy snapshot
65or
66.Fl t Sy all
67options are specified.
68.Bl -tag -width "-H"
69.It Fl H
70Used for scripting mode.
71Do not print headers, and separate fields by a single tab instead of arbitrary
72white space.
73.It Fl j , -json Op Ar --json-int
74Print the output in JSON format.
75Specify
76.Sy --json-int
77to print the numbers in integer format instead of strings in JSON output.
78.It Fl d Ar depth
79Recursively display any children of the dataset, limiting the recursion to
80.Ar depth .
81A
82.Ar depth
83of
84.Sy 1
85will display only the dataset and its direct children.
86.It Fl o Ar property
87A comma-separated list of properties to display.
88Each property must be:
89.Bl -bullet -compact
90.It
91One of the properties described in the
92.Sx Native Properties
93section of
94.Xr zfsprops 7
95.It
96A user property
97.It
98The value
99.Sy name
100to display the dataset name
101.It
102The value
103.Sy space
104to display space usage properties on file systems and volumes.
105This is a shortcut for specifying
106.Fl o Ns \ \& Ns Sy name , Ns Sy avail , Ns Sy used , Ns Sy usedsnap , Ns
107.Sy usedds , Ns Sy usedrefreserv , Ns Sy usedchild
108.Fl t Sy filesystem , Ns Sy volume .
109.El
110.It Fl p
111Display numbers in parsable
112.Pq exact
113values.
114.It Fl r
115Recursively display any children of the dataset on the command line.
116.It Fl s Ar property
117A property for sorting the output by column in ascending order based on the
118value of the property.
119The property must be one of the properties described in the
120.Sx Properties
121section of
122.Xr zfsprops 7
123or the value
124.Sy name
125to sort by the dataset name.
126Multiple properties can be specified to operate together using multiple
127.Fl s
128or
129.Fl S
130options.
131Multiple
132.Fl s
133and
134.Fl S
135options are evaluated from left to right to supply sort keys in
136decreasing order of priority.
137Property types operate as follows:
138.Bl -bullet -compact
139.It
140Numeric types sort in numeric order.
141.It
142String types sort in alphabetical order.
143.It
144Types inappropriate for a row sort that row to the literal bottom,
145regardless of the specified ordering.
146.El
147.Pp
148If no sort columns are specified, or if two lines of output would sort
149equally across all specified columns, then datasets and bookmarks are
150sorted by name, whereas snapshots are sorted first by the name of their
151dataset and then by the time of their creation.
152When no sort columns are specified but snapshots are listed, this
153default behavior causes snapshots to be grouped under their datasets in
154chronological order by creation time.
155.It Fl S Ar property
156Same as
157.Fl s ,
158but sorts by
159.Ar property
160in descending order.
161.It Fl t Ar type
162A comma-separated list of types to display, where
163.Ar type
164is one of
165.Sy filesystem ,
166.Sy snapshot ,
167.Sy volume ,
168.Sy bookmark ,
169or
170.Sy all .
171For example, specifying
172.Fl t Sy snapshot
173displays only snapshots.
174.Sy fs ,
175.Sy snap ,
176or
177.Sy vol
178can be used as aliases for
179.Sy filesystem ,
180.Sy snapshot ,
181or
182.Sy volume .
183.El
184.
185.Sh EXAMPLES
186.\" These are, respectively, examples 5 from zfs.8
187.\" Make sure to update them bidirectionally
188.Ss Example 1 : No Listing ZFS Datasets
189The following command lists all active file systems and volumes in the system.
190Snapshots are displayed if
191.Sy listsnaps Ns = Ns Sy on .
192The default is
193.Sy off .
194See
195.Xr zpoolprops 7
196for more information on pool properties.
197.Bd -literal -compact -offset Ds
198.No # Nm zfs Cm list
199NAME                      USED  AVAIL  REFER  MOUNTPOINT
200pool                      450K   457G    18K  /pool
201pool/home                 315K   457G    21K  /export/home
202pool/home/anne             18K   457G    18K  /export/home/anne
203pool/home/bob             276K   457G   276K  /export/home/bob
204.Ed
205.Ss Example 2 : No Listing ZFS filesystems and snapshots in JSON format
206.Bd -literal -compact -offset Ds
207.No # Nm zfs Cm list Fl j Fl t Ar filesystem,snapshot | Cm jq
208{
209  "output_version": {
210    "command": "zfs list",
211    "vers_major": 0,
212    "vers_minor": 1
213  },
214  "datasets": {
215    "pool": {
216      "name": "pool",
217      "type": "FILESYSTEM",
218      "pool": "pool",
219      "properties": {
220        "used": {
221          "value": "290K",
222          "source": {
223            "type": "NONE",
224            "data": "-"
225          }
226        },
227        "available": {
228          "value": "30.5G",
229          "source": {
230            "type": "NONE",
231            "data": "-"
232          }
233        },
234        "referenced": {
235          "value": "24K",
236          "source": {
237            "type": "NONE",
238            "data": "-"
239          }
240        },
241        "mountpoint": {
242          "value": "/pool",
243          "source": {
244            "type": "DEFAULT",
245            "data": "-"
246          }
247        }
248      }
249    },
250    "pool/home": {
251      "name": "pool/home",
252      "type": "FILESYSTEM",
253      "pool": "pool",
254      "properties": {
255        "used": {
256          "value": "48K",
257          "source": {
258            "type": "NONE",
259            "data": "-"
260          }
261        },
262        "available": {
263          "value": "30.5G",
264          "source": {
265            "type": "NONE",
266            "data": "-"
267          }
268        },
269        "referenced": {
270          "value": "24K",
271          "source": {
272            "type": "NONE",
273            "data": "-"
274          }
275        },
276        "mountpoint": {
277          "value": "/mnt/home",
278          "source": {
279            "type": "LOCAL",
280            "data": "-"
281          }
282        }
283      }
284    },
285    "pool/home/bob": {
286      "name": "pool/home/bob",
287      "type": "FILESYSTEM",
288      "pool": "pool",
289      "properties": {
290        "used": {
291          "value": "24K",
292          "source": {
293            "type": "NONE",
294            "data": "-"
295          }
296        },
297        "available": {
298          "value": "30.5G",
299          "source": {
300            "type": "NONE",
301            "data": "-"
302          }
303        },
304        "referenced": {
305          "value": "24K",
306          "source": {
307            "type": "NONE",
308            "data": "-"
309          }
310        },
311        "mountpoint": {
312          "value": "/mnt/home/bob",
313          "source": {
314            "type": "INHERITED",
315            "data": "pool/home"
316          }
317        }
318      }
319    },
320    "pool/home/bob@v1": {
321      "name": "pool/home/bob@v1",
322      "type": "SNAPSHOT",
323      "pool": "pool",
324      "dataset": "pool/home/bob",
325      "snapshot_name": "v1",
326      "properties": {
327        "used": {
328          "value": "0B",
329          "source": {
330            "type": "NONE",
331            "data": "-"
332          }
333        },
334        "available": {
335          "value": "-",
336          "source": {
337            "type": "NONE",
338            "data": "-"
339          }
340        },
341        "referenced": {
342          "value": "24K",
343          "source": {
344            "type": "NONE",
345            "data": "-"
346          }
347        },
348        "mountpoint": {
349          "value": "-",
350          "source": {
351            "type": "NONE",
352            "data": "-"
353          }
354        }
355      }
356    }
357  }
358}
359.Ed
360.
361.Sh SEE ALSO
362.Xr zfsprops 7 ,
363.Xr zfs-get 8
364