Linux command
pathchk 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Check path for POSIX portability
pathchk [/path/to/file]
Check for portability to older systems
pathchk -p [/path/to/file]
Check for empty names and leading dashes
pathchk -P [path]
Check for full POSIX portability
pathchk --portability [path]
Check multiple paths
pathchk [path1] [path2] [path3]
说明
pathchk checks pathnames for validity and portability. It identifies names that may cause problems on other systems. Default checking verifies the path is valid on the current system: proper length, valid characters, and accessible parent directories. POSIX portability mode (-p) enforces stricter limits. It checks for characters valid on all POSIX systems and limits component lengths to 14 characters (the historical minimum). The -P option adds checks for empty path components and names starting with hyphens, which can cause problems with command arguments. Exit code 0 means all paths passed checks. Non-zero indicates problems were found, with error messages describing issues. The tool helps ensure scripts and archives work across different Unix systems without pathname-related failures.
参数
- -p
- Check against POSIX portable filename character set and minimum path length limits (14-character component limit).
- -P
- Check for empty names and leading dashes.
- --portability
- Check for portability to all POSIX systems (equivalent to -p -P).
- --help
- Show help.
- --version
- Show version.
FAQ
What is the pathchk command used for?
pathchk checks pathnames for validity and portability. It identifies names that may cause problems on other systems. Default checking verifies the path is valid on the current system: proper length, valid characters, and accessible parent directories. POSIX portability mode (-p) enforces stricter limits. It checks for characters valid on all POSIX systems and limits component lengths to 14 characters (the historical minimum). The -P option adds checks for empty path components and names starting with hyphens, which can cause problems with command arguments. Exit code 0 means all paths passed checks. Non-zero indicates problems were found, with error messages describing issues. The tool helps ensure scripts and archives work across different Unix systems without pathname-related failures.
How do I run a basic pathchk example?
Run `pathchk [/path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p do in pathchk?
Check against POSIX portable filename character set and minimum path length limits (14-character component limit).