Solved

How to find what process is locking a file.

Posted on 2003-10-23
3
1,585 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 61

Expert Comment

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

706 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

15 Experts available now in Live!

Get 1:1 Help Now