Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

ArgumentDescription
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

CodeMeaning
0All PIDs were resolved successfully
1One or more PIDs could not be read