cancel
Showing results for 
Search instead for 
Did you mean: 

processes accessing a file

SOLVED
Go to solution
jackie baron_1
Regular Advisor

processes accessing a file

What command(s) can I use to see what process(es) are accessing a file and what kind of access they have (read/write, etc) and can more than one process access a file?

thanks
3 REPLIES
merieux
Frequent Advisor
Solution

Re: processes accessing a file

Hi ,

lsof will be your friend . You should be dowlaod a depot at http://hpux.connect.org.uk/

Regards ,
Patrick Wallek
Honored Contributor

Re: processes accessing a file

>>What command(s) can I use to see what process(es) are accessing a file

fuser and lsof come to mind.

fuser -u yourfilehere

lsof yourfilehere

Note that lsof is not part of a standard HP-UX install and must be installed separately.

See the fuser and lsof (if installed) man pages for more information.

>>what kind of access they have (read/write, etc)

You would have to see what user started the process that is accessing the file, see what groups that user is a member of and then look at the permissions on the file to determine what can be done.

For example, if the user 'fido' is accessing file /a/b/c/file1 and fido is part of groups grp1 and grp3. Do an 'ls -l' on /a/b/c/file1 and look at the permissions.

Say file1 is:

-rwxrwxr-x 1 user1 grp3 123456 Oct 12 08:03 file1

The file is owned by user1 (who has read, write and exec permission) and the group is grp3 (which also has rwx permission). Since 'fido' is a member of grp3 it can read, write and execute the file.

>>can more than one process access a file?

Absolutely!!!!!! It would be hard to be a multi-user operating without that capability!
jackie baron_1
Regular Advisor

Re: processes accessing a file

Lovely. Thank you.