• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1613
  • Last Modified:

How to find what process is locking a file.

In HP-UX, when I tried to delete a certain file, the system complained that this file is currently used. I am wondering if there is a utility which could tell me which process was locking the file. On http://www.sysinternals.com/linux/utilities.shtml, there is a tool called Filemon doing what I want. But it's unavailable under HP-UX platform. I don't mind compiling the source to get it run under my OS.
1 Solution
Try looking lsof. We use it on Solaris and it is very useful.

There is a standard unix commands called fuser.
it will tell u which process is locking the file.

man fuser.

also if u can get lsof, it works the same.
some systems call it fstat or pstat. lsof is more complete sometimes.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now