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`/fdWritten by Dmitry Pashkevich
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#