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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. How to Reinstall Corrupted Library with yum
  2. curl Command Examples in Linux
  3. Maintaining Linux filesystems using “fsck” and “tune2fs”
  4. CentOS / RHEL : How to adjust the telnet timeout (and how to disable it)
  5. bluetoothd: command not found
  6. CentOS / RHEL 6 : How to setup yum repository using locally mounted DVD
  7. How to Change the VNC Server Resolution in Linux
  8. How to run rsyslog as a non-root user in CentOS/RHEL 7
  9. How to Save Command history of Selected Users in Linux
  10. Complete Guide to Configuring iSCSI in CentOS / RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright