Solved

How to find what process is locking a file.

Posted on 2003-10-23
3
1,588 Views
Last Modified: 2013-12-06
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.
0
Comment
Question by:xingdongjin
3 Comments
 
LVL 7

Expert Comment

by:glassd
ID: 9609573
Try looking lsof. We use it on Solaris and it is very useful.

http://freshmeat.net/projects/lsof/
0
 
LVL 24

Accepted Solution

by:
shivsa earned 50 total points
ID: 9610205
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.
0
 
LVL 62

Expert Comment

by:gheist
ID: 9610304
some systems call it fstat or pstat. lsof is more complete sometimes.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now