Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

kill multiple instances of the same program

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 12-16-2007
kill multiple instances of the same program

Hi,

I know that the answer to this is very simple, since I saw somebody do it some time back..but I forgot how.

The problem is, I have multiple instances of the same program running simultaneously and I want to kill them all in a single command.

I know that it can be done using awk '{print $2}' in combination with ps and kill but I am not able to formulate the exact command.

The process in question (to be killed) is xterm.

will deeply appreciated all help.

ipzig
# 2  
Old 12-16-2007
if you have pkill it is a doddle....

Code:
pkill xterm


Last edited by porter; 12-16-2007 at 03:33 AM..
# 3  
Old 12-16-2007
Quote:
Originally Posted by porter
if you have pkill it is a doddle....

[CODE]pkill xterm[/CODE[
Will pkill kill only the instance that a user has permission to kill ?

user A can run the instance proc p1
and user B can also run the same instance proc p1

will pkill identify only the instances from user A and kill only those instances of proc p1

( may be something like ps -fu $user )
# 4  
Old 12-16-2007
Quote:
Originally Posted by matrixmadhan
Will pkill kill only the instance that a user has permission to kill ?
It can't kill the ones you don't.

Last edited by porter; 12-16-2007 at 02:14 PM..
# 5  
Old 12-16-2007
Quote:
Originally Posted by porter
It can't kill the once you don't.
Well, that is true.
Am interested to know whether it would skip it as such or will throw an error stating unable to kill the other instance.

I will check that !
# 6  
Old 12-16-2007
I don't have pkill.

Yet, I know the answers a doddle if you can combine kill, ps -fu, and awk '{print $2}' (with ps).

Only, am not able to do it myself, and waiting for a shell expert to do it for me..

Regards
ipzig
# 7  
Old 12-16-2007
As long as you know the name of the process take a look at the 'killall' command.
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Multiple instances of pthread clerew Programming 2 05-22-2012 01:17 PM
Control multiple program instances - open multiple files problem hakermania Programming 3 02-06-2011 12:06 PM
Grep with multiple instances of same pattern spywarebox Shell Programming and Scripting 3 08-30-2009 04:25 PM
Multiple instances of the job in shell script. Gangegowda Shell Programming and Scripting 1 11-03-2008 05:29 AM
Multiple instances of a job. Gangegowda Shell Programming and Scripting 1 10-16-2008 04:22 AM
multiple instances of same vg on same AIX machine navadeep AIX 1 07-25-2008 01:58 AM
detecting multiple instances ragha81 Shell Programming and Scripting 3 04-06-2007 10:09 AM
Creating instances of a program tushar_johri Shell Programming and Scripting 2 05-25-2005 10:36 AM
Multiple file instances gozer13 UNIX for Dummies Questions & Answers 1 12-29-2004 06:08 PM
multiple instances of syslogd - is it possible? Gary Dunn UNIX for Advanced & Expert Users 9 07-20-2004 09:10 AM


All times are GMT -4. The time now is 08:49 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password