How can you tell who has what files open?

John F Haugh II jfh at rpp386.cactus.org
Mon Apr 8 06:17:36 AEST 1991


In article <1991Apr04.201719.3587 at ka3ovk> albers at ka3ovk.irs.gov.UUCP (Jon Albers) writes:
>Is there a way to find out the process id of a process that has a file open?
>Is there a way to list open files by process id, name, and/or inode?  I
>want to be able to find out where the error starts.

Two commands will tell you has a file open - "fuser" and "ofiles".  "fuser"
is standard with System V.  "ofiles" I believe is mostly a SunOS command,
I'm sure someone from that universe can fill you in.

You might also want to look into the "crash" command, particularly the
"user" subcommand.  It will tell you about open files per process.  You
can then determine the files each process has open by going from the
open file descriptor information to the file table to the inode table.
-- 
John F. Haugh II        | Distribution to  | UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832 | GEnie PROHIBITED :-) |  Domain: jfh at rpp386.cactus.org
"If liberals interpreted the 2nd Amendment the same way they interpret the
 rest of the Constitution, gun ownership would be mandatory."



More information about the Comp.unix.questions mailing list