Forrest logo
back to the mountpoint tool

mountpoint:tldr:215c8

mountpoint: Check if a directory is a mountpoint.
$ mountpoint ${path-to-directory}
try on your machine

The command "mountpoint ${path-to-directory}" is used to check whether a particular directory is a mount point or not.

Here's how it works:

  1. "mountpoint" is the command itself, which is used to check the status of mount points.
  2. "${path-to-directory}" is a placeholder for the actual path of the directory you want to check.
    • In practice, you would replace "${path-to-directory}" with the actual path, like "/media/usb" or "/mnt/share".
    • It is important to note that the path should be an absolute path (starting from the root directory "/").

When you execute this command, the "mountpoint" command checks whether the given directory is a mount point or not. It returns an exit status (return code) indicating the result:

  • If the directory is a mount point, it returns an exit status of 0 (zero).
  • If the directory is not a mount point, it returns a non-zero exit status, usually 1.

This command is often used in scripts or automation workflows to determine the status of a directory before performing further actions like mounting or unmounting drives, checking availability, etc.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mountpoint tool