How do you find out which processes have a lock on a given file, in Linux?

link|improve this question

78% accept rate
feedback

3 Answers

up vote 5 down vote accepted

In addition to lslk, you could also try lsof.

link|improve this answer
feedback

Try fuser

In the example below, I have run fuser against a jar file and it has shown me the pids for the processes using the jar.

$ fuser app.jar

app.jar:    15529m   26293m   23017m
link|improve this answer
feedback

You try lslk?

link|improve this answer
lslk is old stuff; for example, it does not appear anymore in newer releases of RHEL than 3. – wzzrd Oct 5 '09 at 11:13
Yeah, lsof was what I was thinking of. But it was already on my Debian Etch box, so go figure. – emgee Oct 5 '09 at 15:37
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.