• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mountpoint Command Examples in Linux

by Deepika

“mountpoint” is a command-line utility used in Linux and Unix-like systems to test if a directory is a mountpoint, i.e. if it is the location where a filesystem is mounted. A mountpoint is a directory on the file system where a storage device or a remote file system is mounted. When a storage device or a remote file system is mounted, its files and directories are made available at the mountpoint, and can be accessed just like any other files and directories on the file system.

The “mountpoint” command is used to test if a directory is a mountpoint by checking if it is the root of a mounted file system. If the directory is a mountpoint, the “mountpoint” command returns an exit status of 0, and returns an exit status of non-zero otherwise.

For example, you can use the “mountpoint” command to test if the directory “/mnt/data” is a mountpoint, by running the following command:

# mountpoint /mnt/data

If “/mnt/data” is a mountpoint, the command will return an exit status of 0, and you can access the files and directories of the mounted file system at “/mnt/data”. If “/mnt/data” is not a mountpoint, the command will return an exit status of non-zero, and you will not be able to access the files and directories of a mounted file system at “/mnt/data”.

The “mountpoint” command is useful for shell scripts and other programs that need to determine if a directory is a mountpoint, and to take appropriate actions based on this information.

mountpoint Command Examples

1. Check if a directory is a mountpoint:

# mountpoint path/to/directory

2. Check if a directory is a mountpoint without showing any output:

# mountpoint -q path/to/directory

3. Show major/minor numbers of a mountpoint’s filesystem:

# mountpoint --fs-devno path/to/directory

Filed Under: Linux

Some more articles you might also be interested in …

  1. nmcli radio Command Examples in Linux
  2. pacman –database Command Examples in Arch Linux
  3. Linux OS Service ‘avahi-daemon’
  4. CentOS / RHEL : How to find if a network port is open or not?
  5. CentOS / RHEL 6 : How to configure 802.1q VLAN On NIC
  6. Linux Interview Questions – Linux Printing (CUPS)
  7. base64 Command Examples (Encode or decode file or standard input to/from Base64, to standard output)
  8. How To Configure Restricted Bash Shell in Linux
  9. st Command Examples in Linux
  10. named-checkconf: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples
  • gitlint Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright