iu44jq
Last Updated: February 25, 2016
·
518
· dpashkevich
D42a7264714dee5006b9c99d2567a320

Get a list of files opened by a process

Here's a handy snippet to get all file descriptors opened by a particular process in a linux system:

[sudo] ls -l /proc/`pgrep <PROGRAM NAME>`/fd

The pgrep command returns a PID of a running program by its name. If you're trying to use it for scripts (e.g. node myApp.js), try to add the -f option to search by entire run commandline, not just the executable name (which would be just node in my example):

[sudo] ls -l /proc/`pgrep -f myApp`/fd
Say Thanks
Respond
Filed Under