Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
I am working on the tmpfs file system mounted on the particular directory. I want to write my shell script to check whether the tmpfs filesystem is already mounted on the directory.

1 Answer

0 votes
by (36.8k points)

Use the below code to check the type of the filesystem.

$ stat -f -c '%T' /

xfs

$ stat -f -c '%T' /dev/shm

tmpfs

You can also check whether the directory is a mountpoint by comparing its device with its parent's.

$ stat -c '%D' /

901

$ stat -c '%D' /home

fe01

$ stat -c '%D' /home/$USER

fe01

Want to be a Linux expert? Come and join this Linux course

 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jan 6, 2021 in Linux by blackindya (18.4k points)
0 votes
1 answer
asked Dec 10, 2020 in Linux by blackindya (18.4k points)

Browse Categories

...