From owner-freebsd-questions@FreeBSD.ORG Tue Apr 3 16:33:33 2012 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03F12106564A for ; Tue, 3 Apr 2012 16:33:33 +0000 (UTC) (envelope-from illoai@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8A9948FC0C for ; Tue, 3 Apr 2012 16:33:32 +0000 (UTC) Received: by wern13 with SMTP id n13so3218635wer.13 for ; Tue, 03 Apr 2012 09:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Tt7LyVnEfJwuF2W3CpjA42LLaMIw+tJrIzt2waqxcrs=; b=s4mmN+P5p07s9rH9W5gNwcmdvoWjRlHR+ewqOA+v5DewC3cJnbWne5tWRdwshVrTj7 WY2tk2BDqa/+SliOVrJFEZdBwyIP0OUoIjbzwdKX0g6sHDyok9UDSnBijrfJUaPwUQdq qco+asQe9v8iLmYeDOeX9B6sw6W0C3HrywLCzCYSGq6+/t3rFT0iYVUIhQs8pffDRKJh ptBtOJJGnspxpcP2jO82m7DiDcevFv23Ws7bEJah91tJ4P183TTBHx4yiA5ouYjaExRV TRxRDW75apDaP/dxUf59G/pMPb+Ni7i0RBpTpJumX1EIG+We9gByKserzxFhS1vXNwJY cUjA== MIME-Version: 1.0 Received: by 10.180.96.228 with SMTP id dv4mr7878412wib.14.1333470811289; Tue, 03 Apr 2012 09:33:31 -0700 (PDT) Received: by 10.216.135.95 with HTTP; Tue, 3 Apr 2012 09:33:31 -0700 (PDT) In-Reply-To: References: Date: Tue, 3 Apr 2012 12:33:31 -0400 Message-ID: From: "illoai@gmail.com" To: tak.official@gmail.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: questions@freebsd.org Subject: Re: current pids per tty X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2012 16:33:33 -0000 On 3 April 2012 04:19, takCoder wrote: > Hi Everyone, > > i'm trying to find out a way to list *all* the pids of which running in t= he > background of or as the parent *of the current tty* device my shell file = is > running on.. is there a quick way to find it out as for commands like tty > (for current tty) or whoami (for current user) or i should just grep and > sed the output of commands like w =A0or ...? > > as you may know, W(1)'s output just shows the number of pts devices in it= s > tty column.. so it won't be that easy to grep them all(i'm somehow new in > shell scripting as well).. and i need the detailed info about related > processes; like FROM or WHAT outputs of w command.. (BTW, i'm trying to > write a reporting per-tty shell script for my FreeBSD system..) > > it would be very kind of you giving me any tips or tricks on this. tcsh & sh both have a builtin called "jobs" (there is an executable named /usr/bin/jobs, but . . . well run "cat /usr/bin/jobs" & see for yourself). I dunno if that encompasses everything you want to do. --=20 --