Using the mount Command One way we can determine if a directory is mounted is by running the mount command and filtering the output. The above line will exit with 0 (success) if /mnt/backup is a mount point. Otherwise, it'll return -1 (error).
The mount command is the usual way. On Linux, you can also check /etc/mtab, or /proc/mounts.
pwd -P will give you the physical directory you are in, i.e. the pathname of the current working directory with the symbolic links resolved. Using df . would give you the df output for whatever partition the current directory is residing on.
df -P file/goes/here | tail -1 | cut -d' ' -f 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With