There are times when I find it useful to know which filesystem a directory belongs to. For example, I find that Git is very slow in directories that are in NFS mounts. So, I like to disable Git-related actions in my shell when the
PWD is in a NFS mount.
An easy way to check the filesystem of a path is:
stat --dereference --filesystem --format="%T" /path/to/check
Or the shorter version:
stat -L -f -C "%T" /path/to/check
On a directory in a NFS mount, this returns me
nfs. On a locally mounted directory, it returns
ext2/ext3. You can use this return value in your shell scripts to control what happens based on the filesystem.