Brady Hegberg writes:
> I'm looking for a more useful ps command for when you just want to
> find a process to kill it.  All I really need is the command and the
> PID so I tried this:

Try this for a "killall" command:

kill $(ps ahx --format="%c%p" | tr -s ' ' | grep "$NAME " | cut -d' ' -f2)

The command you are looking for is this:

ps ahxwww --format="%p%a"

Note that this method can be dangerous, as it has a race condition: between
the time that you lookup the PID and send the signal, the process can be
killed and a new one started in its place.  This is why PID files are a bad
idea and should not be used.  The proper way to manage processes is to use a
supervisor program, like daemontools.  The daemontools method is not
vulnerable to this race condition.

--
David Phillips <david at acz.org>
http://david.acz.org/


_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
http://www.mn-linux.org tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list