Getting the list of open files

We know that there can be millions of files available in a system, which can be binary files, text files, directories, and so on. When a file is not in use, they are just available on a storage device as 0 and 1. To view or process a file, it needs to be opened. An application that is executing may open multiple files. Knowing what files are opened by a running application is very useful. To know the list of opened files, the lsof command is used.

Executing the following command gives the list of all opened files:

$ lsof

This gives a huge output of all the opened files.

Knowing the files opened by a specific application

To know the list of files opened by a specific application, first get the Process ID (PID) of the ...

Get Linux Shell Scripting Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.