devenish at guild.uwa.edu.au
Mon Apr 12 13:36:19 WST 2004
In message <1081747786.12794.33.camel at localhost.localdomain>
on Mon, Apr 12, 2004 at 01:29:47PM +0800, Craig Ringer wrote:
> On Mon, 2004-04-12 at 13:11, James Devenish wrote:
> > FYI you usually get neater output by using the Solaris-style `pgrep -lf
> > appname` or `ps -C appname` (or pkill, etc, depending on what it is that
> > you know about the state of the system).
> Unfortunately, this doesn't work with KDE apps. For some irritating
> reason, they _all_ run with the process name 'kdeinit':
> [craig]$ pgrep kdeinit
It was very intentional that I included the -lf switches.
> Otherwise, I tend to agree with you - pgrep and pkill are much cleaner.
> I have, unfortunately, found that 'pkill ssh' (to kill an ssh tunnel
> that's been broken by suspending my laptop) also likes to kill
> ssh-agent, where killall does not.
pgrep is designed that way. To match only 'ssh' (and not 'sshd' or
'ssh-agent'), you'd use the -n option (e.g. `pkill -n ssh`).
Alternatively, since its argument is a regular expression, you could
use `pkill ssh\$` (or `pkill ssh$` in ksh/Bash).
> Of course, I learned all about the /other/ face of killall when
> working on our SCO accounts & bookings server :-(
Linux: kinda like SysV, kinda like BSD.
More information about the plug