The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ypbind - multiple instances starting blowtorch SUN Solaris 0 10-01-2007 06:51 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 07:08 PM
multiple instances of syslogd - is it possible? Gary Dunn UNIX for Advanced & Expert Users 9 07-20-2004 09:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-16-2007
ipzig ipzig is offline
Registered User
  
 

Join Date: Aug 2005
Location: in my heart. ..kidding. Calcutta, India.
Posts: 13
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 (permalink)  
Old 12-16-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
if you have pkill it is a doddle....

Code:
pkill xterm

Last edited by porter; 12-16-2007 at 04:33 AM..
  #3 (permalink)  
Old 12-16-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Quote:
Originally Posted by porter View Post
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 (permalink)  
Old 12-16-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by matrixmadhan View Post
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 03:14 PM..
  #5 (permalink)  
Old 12-16-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
Quote:
Originally Posted by porter View Post
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 (permalink)  
Old 12-16-2007
ipzig ipzig is offline
Registered User
  
 

Join Date: Aug 2005
Location: in my heart. ..kidding. Calcutta, India.
Posts: 13
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0