1834826 Members
3147 Online
110070 Solutions
New Discussion

file in use

 
Ralf Buchhold
Regular Advisor

file in use

Hello
I need a script or a procedure where I can automaticly find out a used file.

Perhaps with a for next statement.

Thanks
Ralf
2 REPLIES 2
Bill Hassell
Honored Contributor

Re: file in use

The command: fuser will report process ID's that have the file open. You can use the find command to provide a list of files to process with fuser, something like this:

find /etc -type f -exec fuser {} \;

Now this will produce several hundred lines of output, mostly blank lines. You can write your script to filter the blank lines.


Bill Hassell, sysadmin
Slawomir Gora
Honored Contributor

Re: file in use

Hi,


you can download lsof utility (List files,
sockets, etc opened by processes)
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.73/