194. How will you find which processes are using a file?
We can use lsof command to find the list of Process IDs of the processes that are accessing a file in Unix.
Lsof stands for List Open Files.
Sample command is:
% lsof /var
It will list the processes that are accessing /var directory in current unix system.
We can use options –i, -n and –P for different uses.
% lsof –i will only list IP sockets.