From owner-freebsd-questions Tue Jan 28 14:25:44 2003 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 BDE3D37B401 for ; Tue, 28 Jan 2003 14:25:42 -0800 (PST) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3542C43F75 for ; Tue, 28 Jan 2003 14:25:42 -0800 (PST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.6/8.12.6) id h0SMPaK3006950; Tue, 28 Jan 2003 16:25:36 -0600 (CST) (envelope-from dan) Date: Tue, 28 Jan 2003 16:25:36 -0600 From: Dan Nelson To: Josh Brooks Cc: freebsd-questions@FreeBSD.ORG Subject: Re: how to kill a while loop... Message-ID: <20030128222536.GG17299@dan.emsphone.com> References: <20030128140811.O54977-100000@mail.econolodgetulsa.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030128140811.O54977-100000@mail.econolodgetulsa.com> X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.3i 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 In the last episode (Jan 28), Josh Brooks said: > > Hi, > > I ran a command like: > > while `some command` ; do something ; done & > > and I missed the PID output when I backgrounded it. > > Now I want to kill this while process, but I cannot find it anymore. > > I tried to ps auxw | grep while, and grep do and so on, but I cannot find > the process to kill it. Two ways: 1 - Type in "jobs -l", which will list all the backgrounded jobs your shell knows about and their pids. Then run "kill nn", where nn is the process id, which is the second number. The first is the job number, which will usually be 1. 2 - If you exited your shell or disowned the job, it won't show up in 'jobs'. Run "ps axl | egrep 'mycommand|PID'", and kill the command's parent process (PPID column). -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message