Linux: check if filesystem is mounted

ufs

Senior member
Jun 3, 2001
310
0
0
I am writing a script to execute a program if a certain filesystem is mounted. How do I check that? I couldn't find an appropriate command to achieve that. Any help will be highly appreciated. I am working in RedHat Enterprise Linux 4. Thanks.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The 'mount' command will output all of the mounted filesystems. Or you can look at /proc/mounts directly. Or if you know of a certain file/directory that will always exist on that mounted filesystem but not otherwise you could check for it's existance before running your script.