pwdx
Report current working directory of a process.
Description
For each given process ID, reads and displays the process’s current working directory.
Inputs
/proc/[pid]/cwd– symlink to the process’s current working directory
Arguments
| Argument | Description |
|---|---|
pid... (required, positional) | One or more process IDs |
Behavior
For each PID argument, reads the /proc/[pid]/cwd symlink and prints:
PID: /path/to/cwd
If a PID cannot be read (process does not exist, permission denied, or other error), an error message is printed to stderr and processing continues with the remaining PIDs.
Exit codes
| Code | Meaning |
|---|---|
| 0 | All PIDs were resolved successfully |
| 1 | One or more PIDs could not be read |