From owner-freebsd-questions Sun Jan 24 21:36:20 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA19931 for freebsd-questions-outgoing; Sun, 24 Jan 1999 21:36:20 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA19925 for ; Sun, 24 Jan 1999 21:36:16 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.1/8.9.1) id XAA14218; Sun, 24 Jan 1999 23:29:47 -0600 (CST) Date: Sun, 24 Jan 1999 23:29:46 -0600 From: Dan Nelson To: Eugeny Kuzakov Cc: questions@FreeBSD.ORG Subject: Re: pid&work dir Message-ID: <19990124232946.A14190@dan.emsphone.com> References: <19990124231635.A13953@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: ; from "Eugeny Kuzakov" on Mon Jan 25 11:25:39 GMT 1999 X-OS: FreeBSD 3.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Jan 25), Eugeny Kuzakov said: > On Sun, 24 Jan 1999, Dan Nelson wrote: > > > One question. > > > I know PID of process. How can I know work dir, where it run ? > > > Linux has key for ps. In Solaris I can view it in /proc.. > > > thaks for advices. > > fstat -p pid > > or (after installing /usr/ports/sysutils/lsof) > > lsof -p pid > > I recommend using lsof, since it's portable across most Unixes and that > > means you only have to learn one command. > I know about this. This commands shows which files/sockets process > use... "I know work dir, where it run ?"... $ pwd /usr/home/dan $ echo $$ 2593 $ lsof -p 2593 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sh 2593 dan cwd VDIR 4,196608 2048 192017 /usr/home/dan sh 2593 dan rtd VDIR 4,196608 1024 2 / sh 2593 dan txt VREG 4,196608 355088 131945 /bin/sh sh 2593 dan 0u VCHR 12,2 0t3605 13266 /dev/ttyv2 sh 2593 dan 1u VCHR 12,2 0t3605 13266 /dev/ttyv2 sh 2593 dan 2u VCHR 12,2 0t3605 13266 /dev/ttyv2 $ The filedescriptor marked "cwd" is the current working directory. -Dan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message