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?
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.
If the filesystem is not mounted (but if it is as well):
blkid -o value -s TYPE /dev/xxx
or:
file -Ls /dev/xxx
where xxx stands for actual block device name like sda1.
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/xxx
will also give you that information, this time by querying the udev data (something like /run/udev/data/b$major:$minor).
(eval $(blkid $DEV | awk ' { print $3 } '); echo $TYPE)...
– Tobias Kienzler
Nov 02 '12 at 06:59
file . Good stuff.
– Felipe Alvarez
Sep 15 '15 at 03:53
lsblk -f /dev/sdX for more verbose output.
– mivk
Jul 13 '17 at 07:53
mountwon't show the file system mounted by fuse, just that it's afuseblk– Evan Carroll Dec 25 '16 at 21:46stat -f /var, for example. – CivFan Apr 12 '17 at 16:09fusecase, this helps:lsblk -no name,fstype– Basj Nov 26 '20 at 20:13dfcommand to accomplish this? It seems to require more arguments than simply-t(mine does-tinstead of-T). – Brōtsyorfuzthrāx Aug 18 '22 at 01:22dfand for-T(list types) expects nothing else. For-t(filter types) indeed expects one of the files system types listed by-T. Sure when executingdfon your machine is run the command you are expecting and not an alias or a function? Thetype dfcommand may shed light on that. To make sure no alias or function with the same name interferes, try to executecommand df -Tinstead. Here you can see how it works on my machine: https://pastebin.com/UkmNyNGG – manatwork Aug 18 '22 at 03:01df --versionit saystoybox 0.8.0-android. There's no-Toption on mine, but I do get similar output as your-Tif I just rundfwith no arguments, except there's no type column. – Brōtsyorfuzthrāx Aug 18 '22 at 03:39mountwithout parameters, though that will probably display a huge list of mountpoints. – manatwork Aug 18 '22 at 04:00