commands
lsof — Inspect open files
List open files with zero links for an authorized process. Output is permission- and platform-dependent; it may expose paths. In a disposable VM inspect only a known lab process, never unrelated users. +L1 selects files with link count less than one. Use a fresh private workspace; No production workload is required.
Formal Syntax & Structure
linux syntaxlinux
lsof -a -p PID +L1Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -a | option | AND selection criteria |
| -p | option | Select process ID |
| PID | operand | Authorized lab process ID |
| +L1 | operand | Select link counts below one |
Return Value
exit status and output
The selected query prints matching open-file records for the specified process. No matching records can yield nonzero status; inspect diagnostics separately from an empty result, and account for process lifetime and permission limits.
Working Example
Example Snippetlinux
lsof -a -p "$$" +L1