↑ ↓ select, Enter open, Esc close

Show open files of a process

Adjust the values, the command updates live
root@server
lsof -p 1234

Shows every file, library, socket and network connection the process holds open. For a hanging PHP process, this reveals which file or connection it is waiting on. lsof /path/to/file works the other way around: which process holds a file open.

Note: lsof is not always preinstalled on Debian (apt install lsof). Alternatively, ls -l /proc/<PID>/fd shows the open file descriptors.

Also searched as

  • which files does this process have open
  • what is this process doing right now
  • open files of a pid
  • lsof for a process

Related one-liners

All in Processes

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.