How do I list all open files for a Linux or UNIX process using command line options? How can I show open files per process under Linux?

Both Linux and Unix-like operating systems come with various utilities to find out open files associated with the process.

UNIX List Open Files For Process

First use the ps command command to get PID of process, enter:

$ ps -aef | grep {process-name}

$ ps -aef | grep httpd

Next pass this PID to pfiles command,

$ pfiles {PID}

$ pfiles 3533

See pfiles command documentation for more information

FreeBSD list open files per process

On FreeBSD use the fstat command along with the ps command:

## ps aux | grep -i openvpn ``## filter outputs using the ``[grep command](https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/)`` #

## fstat -p {PID}

## fstat -p 1219

#linux / unix

Linux / UNIX List Open Files for Process
2.25 GEEK