Senior
What methods can be used to view files that were opened by a process (Linux)?
sobes.tech AI
Answer from AI
In Linux, you can view files opened by a process using the following methods:
- Through the directory
/proc/[pid]/fd/— contains symbolic links to files opened by the process with the specified pid.
ls -l /proc/1234/fd/
- Using the
lsofcommand (list open files):
lsof -p 1234
- The
fusercommand shows processes using a file, but in the reverse direction.
These methods allow you to get a list of open files, including regular files, sockets, devices, etc.