Possible Duplicate:
How to tell what type of filesystem you’re on?
Find filesystem of an unmounted partition from a script

How can I quickly check the filesystem of the partition? Can I do that by using df?


Yes, according to man df you can:

-T, --print-type      print file system type

Another way is to use the mount command. Without parameters it lists the currently mounted devices, including their file systems.

In case you need to find out only one certain file system, is easier to use the stat command's -f option instead of parsing out one value from the above mentioned commands' output.

  • 3
    mount won't show the file system mounted by fuse, just that it's a fuseblk – Evan Carroll Dec 25 '16 at 21:46
  • stat -f /var, for example. – CivFan Apr 12 '17 at 16:09
  • @EvanCarroll in the fuse case, this helps: lsblk -no name,fstype – Basj Nov 26 '20 at 20:13

If the filesystem is not mounted (but if it is as well):

blkid -o value -s TYPE /dev/block/device


file -Ls /dev/block/device

You'll generally need read access to the block device. However, in the case of blkid, if it can't read the device, it will try to get that information as cached in /run/blkid/blkid.tab or /etc/blkid.tab.

lsblk -no FSTYPE /dev/block/device

will also give you that information, this time by querying the udev data (something like /run/udev/data/b$major:$minor).

  • Perfect, this works also for unmounted filesystems and even images. And looks less weird than (eval $(blkid $DEV | awk ' { print $3 } '); echo $TYPE)... – Tobias Kienzler Nov 2 '12 at 6:59
  • 1
    I like this because it does not require mounting the device, and uses common "off the shelf" utilities, like file . Good stuff. – Felipe Alvarez Sep 15 '15 at 3:53
  • 1
    For exfat and probably other fuse mounted filesystems, only the last lsblk example works. Or lsblk -f /dev/sdX for more verbose output. – mivk Jul 13 '17 at 7:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.