pathchk
checks pathnames for validity and portability
TLDR
SYNOPSIS
pathchk [-p] [-P] pathname...
DESCRIPTION
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.
PARAMETERS
-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.
CAVEATS
Portability mode is conservative. Modern systems accept longer names. Some checks may be overly strict for single-system use.
HISTORY
pathchk is part of GNU coreutils and specified by POSIX. It provides a standard way to validate pathnames for cross-platform scripts and utilities.
