[Sunhelp] RE: Problem on creating a script to kill processes

Lund, Dennis Dennis.Lund at Nextel.com
Fri Jan 21 13:58:09 CST 2000


Try this handy little command:

	ps -ef | awk '/<name>/ {print $2}' | xargs kill

Where <name> is a unique part of the process command or user name.

	example: ps -ef | awk '/nfs/ {print $2}' | xargs kill

This will kill all processes that have the pattern "nfs" in it.

Dennis L. Lund
NEXTEL Systems Administrator
(678)291-3519
dennis.lund at nextel.com

		Message: 2
		Date: Thu, 20 Jan 2000 11:31:45 -0600
		From: John Kennedy <jkennedy at orent.com>
		Organization: Orent Graphics
		To: sunhelp at sunhelp.org
		Subject: Re: [Sunhelp] Problem on creating a script to kill
processes.
		Reply-To: sunhelp at sunhelp.org

		Miguel Demaerel wrote:
		> 
		> Hoi All
		> 
		> I'm a newbie on this platform.
		> 
		> I wont to create a script that kill several processes.
		> 
		> ps -ef | grep "name" |awk '{print $2}
		> Now I have a list of PID, but how can I kill these
processes?
		> 
		> kill ???
		> 
		> Are there any good site or books on writing scripts?
		> 
		> Thanks
		






More information about the SunHELP mailing list