Junior — Middle
How can you determine the list of files opened by a process in a Linux system?
sobes.tech AI
Answer from AI
In Linux, to determine the list of files opened by a process, you can use the lsof (list open files) command.
Example:
lsof -p <PID>
where <PID> is the process ID.
This command will display all files (including regular files, sockets, devices, etc.) opened by the given process.
If lsof is not installed, you can look at the contents of the /proc/<PID>/fd/ directory, which contains symbolic links to the open files:
ls -l /proc/<PID>/fd/
Each link points to a file that the process has opened.