From owner-freebsd-questions Mon Aug 26 21: 5: 5 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88F6137B400 for ; Mon, 26 Aug 2002 21:05:01 -0700 (PDT) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1899143E81 for ; Mon, 26 Aug 2002 21:04:58 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: from hades.hell.gr (patr530-b149.otenet.gr [212.205.244.157]) by mailsrv.otenet.gr (8.12.4/8.12.4) with ESMTP id g7R44lpD002369; Tue, 27 Aug 2002 07:04:49 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.5/8.12.5) with ESMTP id g7R44jKB001164; Tue, 27 Aug 2002 07:04:45 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.5/8.12.5/Submit) id g7R44g5d001159; Tue, 27 Aug 2002 07:04:42 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Tue, 27 Aug 2002 07:04:36 +0300 From: Giorgos Keramidas To: fred@timogen.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: pidof command in freebsd Message-ID: <20020827040436.GA1064@hades.hell.gr> References: <003e01c24dfb$0f5d0680$8d05a8c0@fred> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003e01c24dfb$0f5d0680$8d05a8c0@fred> X-PGP-Fingerprint: C1EB 0653 DB8B A557 3829 00F9 D60F 941A 3186 03B6 X-Phone: +30-944-116520 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-08-27 11:53 +0000, fred@timogen.com wrote: > There is a command pidof in linux, which can get the pid of a program. > Does there are some commands in freebsd which have the same functions? Yes, ps(1). You can wrap ps(1) in a shell script if you're looking for program names though. Try using something like: charon@hades[07:03]/home/charon$ ps xau | awk '$11 ~ /getty/ {print $2}' 717 718 719 720 721 722 Make that a script, and call it pidof, or whatever you like, but ps(1) is the ``process status'' program. -- FreeBSD: The Power to Serve -- http://www.FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message