Do not use mount
.
From man mount
:
- The listing.
- The listing mode is maintained for backward compatibility only.
- For more robust and customizable output use
findmnt
(8), especially in your scripts.
- Note that control characters in the mountpoint name are replaced with ?.
Use findmnt
, as the documentation suggests. Here are a few interesting options as described by findmnt --help
:
-i
or --invert
- invert the sense of matching
-R
or --submounts
- print all submounts for the matching filesystems
-t
or --types
list
- limit the set of filesystems by FS types
Those are only a couple of the many filters you can apply on the commandline.
man findmnt
- EXAMPLES
findmnt --fstab -t nfs
- Prints all NFS filesystems defined in
/etc/fstab
.
findmnt --fstab /mnt/foo
- Prints all
/etc/fstab
filesystems where the mountpoint directory is /mnt/foo
. It also prints --bind
mounts where /mnt/foo
is a source.
You might use:
findmnt -it sysfs,cgroup,proc,devtmpfs,devpts,pstore,debugfs,hugetlbfs,mqueue,configfs
That should filter out all pseudo-filesystems, I believe.
Still, you can do the same with mount
:
mount -t nosysfs,nodevtmpfs...
Possibly a better way might be to use one of either the following commands, which findmnt --help
describes as noted:
findmnt -D
or findmnt --df
- Imitate the output of
df
(1). This option is equivalent to -o SOURCE,FSTYPE,SIZE,USED,AVAIL,USE%,TARGET
but excludes all pseudo filesystems. Use --all
to print all filesystems.
You can add list fields to the defaults with findmnt -Do
+field,+field
.... You can specify your own list of fields using only the file-systems -D
would show by omitting the +
like findmnt -Do
field,field
.
alias mnt="mount | grep '^/dev'"
i use this to show the "devices" only. – pcarvalho Jan 13 '19 at 15:50mount
. I will never understand why this command deserved the dirty bomb of the endless tmps, cgroups, pstores, debugfs, configfs and so on, instead of use another commands for such mounts or at least show only with some non-default option. – Fran Jun 02 '20 at 07:12