Subject: Re: su sequence
To: Ray Phillips <r.phillips@jkmrc.uq.edu.au>
From: Greg A. Woods <woods@weird.com>
List: port-i386
Date: 08/30/2002 11:17:51
[ On Thursday, August 29, 2002 at 21:49:36 (-0700), Greywolf wrote: ]
> Subject: Re: su sequence
>
> As far as restricting it to the current terminal session, you'd have to
> vgrep it for tty and/or time slot.
Indeed if it's only the current terminal session one is interested in
then it's as simple as:
$ su
# ps -ut $(tty)
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 8840 0.0 0.1 364 176 p4 R+ 11:07AM 0:00.01 ps -ut /dev/ttyp4
root 8779 0.6 0.2 648 592 p4 S 11:07AM 0:00.18 ksh
woods 1580 0.0 0.2 664 524 p4 Ss 15Aug02 0:02.45 -ksh
# su operator
$ ps -ut $(tty)
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
operator 8909 1.1 0.2 588 524 p4 S 11:09AM 0:00.10 ksh
operator 8935 0.0 0.1 364 280 p4 R+ 11:09AM 0:00.00 ps -ut /dev/ttyp4
root 8779 0.0 0.2 664 608 p4 S 11:07AM 0:00.21 ksh
woods 1580 0.0 0.2 664 540 p4 Is 15Aug02 0:02.46 -ksh
If the order they were done in is important to you then just ask 'ps' to
show you the job-control related information instead:
$ ps -jt $(tty)
USER PID PPID PGID SESS JOBC STAT TT TIME COMMAND
woods 1580 1543 1580 df3280 0 Is p4 0:02.46 -ksh
root 8779 1580 8779 df3280 1 I p4 0:00.21 ksh
operator 8909 8779 8909 df3280 1 S p4 0:00.10 ksh
operator 8970 8909 8970 df3280 1 R+ p4 0:00.00 ps -jt /dev/ttyp4
--
Greg A. Woods
+1 416 218-0098; <g.a.woods@ieee.org>; <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>