0

I am intersted to know how many processes or any other entity whatsover, holds a specific file on the system. I tried to find a way using lsof (I don't want to aggregate all the holders for effectiveness reasons), but couldn't find anything in the man page.

Please note that I don't mean the inode link count that is counting the hardlink count for this specific file on the fs.

Edit: I know now it is possible to use fuser (mentioned in one of the answers below) to get this information, but fuser uses procfs and therefore it is not very efficient. Does anyone knows of any other tool which doesn't iterate procfs?

Thanks.

Eytan Naim
  • 159
  • 14

1 Answers1

1

Try using following command

fuser filename

You can also try

lslocks
devadrion
  • 216
  • 2
  • 6
  • fuser is part of the PSmisc which according to its GitHub [page](https://github.com/acg/psmisc) indeed uses "A set of tools that use the proc filesystem". I guess this make it iterate across all processes on the running system and find out who holds the file. Am I right? – Eytan Naim Dec 25 '16 at 12:34