RE: [Lug-Nuts] Oneliners

From: Lancashire, Andrew (LancashireA@sutterhealth.org)
Date: Thu Sep 23 1999 - 17:47:45 PDT


(This is my alternate address I am sending from.)

You are right with the killall command. On some UNIX systems where the
killall command is absent it becomes handy. The ssh via multiple hops will
not work also this is mainly used for telnet/ssh directly into a host. As
for the output of "who am i" across the various UNIX flavors that will also
vary, however the basic outline and functionality is still there. Its
really no big deal to go and change field separator and the variable to make
it work for your specific systems/flavors of Unix.

Andrew
-----Original Message-----
From: Mike Simons [mailto:msimons@fsimons01.erols.com]
Sent: Thursday, September 23, 1999 5:21 PM
To: lug-nuts@cheapnet.net
Subject: Re: [Lug-Nuts] Oneliners

On Tue, Sep 21, 1999 at 11:25:50AM -0700, Mike Machado wrote:
> ps -ef | grep xterm | egrep -v grep | awk '{print "kill -9 " $1}' | sh

  kill -9 `ps aux | awk '/xterm/ { print $1 }'`
  killall -9 xterm # if you system supports this

> The above: Kills all xterm windows.
[...]
> Here is one (below) that automatically sets your DISPLAY variable to the
> hostname/ip address that you are telneting or sshing in from.

  ...just a note: ssh automatically redirects X data through an encrypted
channel back to the machine that ssh'd in and is smart enough to redirect
through multiple sites (if you got through three ssh'es the data will be
redirected through three encrypted channels). So you shouldn't use (or
need)
this one liner when using ssh.
 
> export DISPLAY=`who am i | awk -F\( '{print $2}'| awk -F\) '{print
$1}'`:0.0

... also 'who am i' prints out data in a different format on my machine:
  gabriel!msimons tty7 Sep 22 11:11

so I wasn't able to play with that command...

  Later,
    Mike Simons



This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:07 PST