dysk
dysk is a linux utility listing your filesystems.
Usage
Usage: dysk [-a, --all] [PATH]
Table
The standard output of dysk is a table with a default set of columns and only the “normal looking” filesystems. You can modify it easily.
Columns
You can run dysk --list-cols for the list of all columns.
All columns:
| name | default | meaning |
|---|---|---|
| id | mount point id | |
| dev | device id | |
| filesystem | ✓ | filesystem |
| label | label | |
| type | ✓ | filesystem type |
| remote | whether it’s a remote filesystem | |
| disk | ✓ | short tag of the underlying storage identified |
| used | ✓ | cumulated size of the occupied blocks |
| use | ✓ | graphical view of the use share |
| use_percent | percentage of occupied blocks | |
| free | ✓ | cumulated size of the available blocks |
| free_percent | percentage of available blocks | |
| size | ✓ | size of the volume |
| inodesfree | available inodes | |
| inodesused | inodes used | |
| inodes | inodes use share, graphical | |
| inodes_use_percent | inodes use share, in percents | |
| inodescount | total number of inodes in the filesystem | |
| mount | ✓ | mounting path |
Choose columns
With the --cols launch argument, shortened as -c, you can change the displayed columns or their order.
With -c all, you may see all available columns, but that’s normally too much for convenience:
The most obvious use of the --cols argument is the explicit definition of the columns to display.
For example dysk -c label+use+size+disk+mount will show the label, use, size, disk, and mount columns, in that order.
Sort
With the --sort launch argument, shortened as -s, you can specify the order of displayed rows.
The argument’s value must be either a column name, for example dysk -s dev, or a column name and a direction, for example dysk --sort size-desc.
The desc and asc directions can be abbreviated into d and a.
CSV
With the --csv argument, you can ask dysk to output the table in CSV:
dysk --csv > mounts.csv
You may choose the separator with the --csv-separator argument.
Filters, sorting, and column selection work the same than for standard tables so you may do this:
dysk --csv -f 'size>100G' -c remote+default+inodes > mounts.csv
JSON
Use -j or --json. The normal output is an array of all filesystem matching the filter.
dysk -j | jq '.[0]' > disk.json
{
"bound": false,
"dev": {
"major": 8,
"minor": 1
},
"disk": {
"crypted": false,
"ram": false,
"removable": false,
"rotational": false,
"type": "SSD"
},
"fs": "/dev/sda1",
"fs-label": null,
"fs-type": "ext4",
"id": 26,
"mount-point": "/",
"remote": false,
"stats": {
"available": "81G",
"bavail": 19764035,
"bfree": 22790364,
"blocks": 59233748,
"bsize": 4096,
"inodes": {
"avail": 13880393,
"files": 15114240,
"free": 13880393,
"used-percent": "8%"
},
"size": "243G",
"used": "162G",
"used-percent": "67%"
},
"unreachable": false
}The disk, stats, and stats.inodes structures, or the fs-label, may be null for some filesystems.
Filter
The --filter argument, shortened in -f, lets you specify a constraint, or combine several ones.
A constraint can be related to any column.
You can for example fetch the filesystems with a given type with dysk -f 'type=xfs'.
Or remote volumes with dysk -f 'remote=true'.
The operators you can apply to a column are the following ones:
| operator | meaning |
|---|---|
< | lower |
<= | lower or equal |
> | greater |
>= | greater or equal |
<> | different |
= | somehow equal - for example fs=sda matches /dev/sda1 |
== | really equal |
You can combine several column conditions with boolean operators | (or), & (and) and ! (not) and if needed you can use parenthesis.
For example you may want to select the volumes with not enough space with
dysk -f 'free<100G | use>65%'