How to Get the List of Mounted Filesystems in Linux
-
Read Contents of the
/proc/mounts
to Get the List of Mounted Filesystems in Linux -
Read Contents of the
/etc/mtab
to Get the List of Mounted Filesystems in Linux -
Use the
findmnt
Command to Get the List of Mounted Filesystems in Linux -
Use the
df
Command to Get the List of Mounted Filesystems in Linux -
Use the
lsblk
Command to Get the List of Mounted Filesystems in Linux
The Linux operating system consists of a hierarchical file system. There can be many different types of file systems, ext4
, tmpfs
, securityfs
, configfs
, etc.
This article will explain how to get the list of mounted filesystems in Linux.
In Linux, you can attach a storage device such as a USB flash drive or a file system to the existing directory using the mount
command and detach it from the system using the umount
command.
Now let’s examine ways to access the list of file systems mounted to the system.
Read Contents of the /proc/mounts
to Get the List of Mounted Filesystems in Linux
The /proc/mount
contains a list of all the filesystems mounted on the system. We can read its contents with the cat
command to access the list.
cat /proc/mounts
Output:
Read Contents of the /etc/mtab
to Get the List of Mounted Filesystems in Linux
The /etc/mtab
also contains a list of all mounted filesystems. We can read its contents with the cat
command to access the list.
cat /etc/mtab
Output:
Use the findmnt
Command to Get the List of Mounted Filesystems in Linux
The findmnt
command finds mounted filesystems and lists them in the tree-like format. If you do not want it to use a tree-like format, you can list it with the -l
parameter.
findmnt
Output:
Use the -t
parameter to list only specific filesystems.
findmnt -t ext4
Output:
Use the df
Command to Get the List of Mounted Filesystems in Linux
The df
command stands for disk free. It shows the file system’s total, used, and available disk sizes. The -h
flag is used to display the sizes human-readable, and the -T
flag is used to print file system type.
df -hT
Output:
Use the lsblk
Command to Get the List of Mounted Filesystems in Linux
The lsblk
command finds mounted filesystems and lists them in the tree-like format. Use the -f
parameter to get information about file systems.
sudo lsblk -f
Output:
Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.
LinkedIn