Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!sdd.hp.com!uakari.primate.wisc.edu!crdgw1!barnett From: barnett@grymoire.crd.ge.com (Bruce Barnett) Newsgroups: comp.unix.misc Subject: Re: Who's in my Directory ? Message-ID: Date: 28 Nov 90 17:14:06 GMT References: <1990Nov21.004657.10564@mcs.kent.edu> <1990Nov21.013355.16798@maverick.ksu.ksu.edu> <1990Nov21.185812.19152@athena.mit.edu> Sender: news@crdgw1.crd.ge.com Reply-To: barnett@crdgw1.ge.com Organization: GE Corp. R & D, Schenectady, NY Lines: 32 In-reply-to: jik@athena.mit.edu's message of 21 Nov 90 18:58:12 GMT In article <1990Nov21.185812.19152@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >Both of these are correct, but a better answer is that the "ofiles" program >can tell you both which processes have a given directory open as their current >working directory, and which processes are accessing a particular filesystem. >"Ofiles" is available at an comp.sources.unix archive near you, in volume 18. Here is a shell script that might work for BSD systems. I call it 'pswd' Output looks like: barnett 4777 co 0:00 PWD=/home/kreskin/u0/barnett etc. This only works is a processes current working directory is visible with a ps wweuax command. #!/bin/sh # this script is like ps but prints out the current directory also ps wweuax!| awk ' /PWD/ { # print user PID TTY COMMAND printf "%8s %8s %2s %14s ",$1,$2,$7,$10 ; for (i=11;i