Linux command
mountpoint 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Check
mountpoint [path/to/directory]
Example
mountpoint -q [path/to/directory]
Example
mountpoint -d [path/to/directory]
Example
mountpoint -x [/dev/sda1]
说明
mountpoint checks whether a given directory or file is a filesystem mountpoint by examining /proc/self/mountinfo. It is commonly used in shell scripts to verify mount status before performing operations. The command returns exit code 0 if the path is a mountpoint, and exit code 32 if it is not. Exit code 1 indicates usage errors or system failures.
参数
- -d, --fs-devno
- Display major/minor device numbers for the mounted filesystem
- -q, --quiet
- Suppress all output; use exit code only
- --nofollow
- Do not follow symbolic links at final path component
- -x, --devno
- Output major/minor numbers for a block device
- -h, --help
- Display help and exit
- -V, --version
- Display version and exit
FAQ
What is the mountpoint command used for?
mountpoint checks whether a given directory or file is a filesystem mountpoint by examining /proc/self/mountinfo. It is commonly used in shell scripts to verify mount status before performing operations. The command returns exit code 0 if the path is a mountpoint, and exit code 32 if it is not. Exit code 1 indicates usage errors or system failures.
How do I run a basic mountpoint example?
Run `mountpoint [path/to/directory]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --fs-devno do in mountpoint?
Display major/minor device numbers for the mounted filesystem