Findmnt – Find all mounted filesystems on Linux
Findmnt is a command-line tool in Linux which lists the all-mounted file system on the system. findmnt searches for the mounted file in t/etc/fstab, /etc/mtab, or /proc/self/mountinf locations. By default, it shows all mounted file systems on the system. This command is preinstalled on the system. This command comes with package util-Linux. Now let see how to use the findmnt tool.
Listing the file system
To see all file systems mounted on the system, we can simply use the findmnt command:
Then the output will be in the tree-like structure.
The columns in the output show the following information:
- TARGET: It shows target mount point
- SOURCE: It shows the source device
- FSTYPE: It shows the type of file system.
- OPTIONS: It will show the file system mount options.
Files system in a list format
By default, findmnt shows the output in the form of tree like structure. To get output in the form list, use -l option with the findmnt command:
Listing the system in df format:
To get the output in the form of df command like output format, use findmnt with option -D or –df. This option will show the output in the form of df format.
fstab output list:
To show the Filesystem information, fetched from the directory /etc/fstab file and /etc/fstab.d use findmnt command with -s or –fstab options.
Filter out file system:
To get the output of specific file systems types, we can use -t or –types option with findmnt command. To filter multiple file systems, mention file system type separated by comma.
findmnt -t ext4
To get the output in the format in a random fashion use the -r or –raw option with findmnt command.
Search with the source device
To get the output of the specific source device, use the -S with findmnt command.
findmnt -S /dev/sda2
Search by mount point
To get the output in of specific TARGET or mount point, use the -T or –target option with findmnt command
findmnt -T /
To know more about the findmnt command, read the man page of the findmnt.