![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Diff b/n kill and kill -9 | ammu | UNIX for Advanced & Expert Users | 2 | 07-18-2007 06:29 PM |
| kill(0,-9) don't kill the process | umen | High Level Programming | 9 | 06-19-2007 07:09 AM |
| not able to kill find with kill -9 | Amardeep | UNIX for Dummies Questions & Answers | 5 | 01-04-2007 05:49 PM |
| KILL PID, intern should kill another PID. | rkrgarlapati | Shell Programming and Scripting | 4 | 10-17-2006 08:47 AM |
| When kill doesnt work, how to kill a process ? | VijayHegde | UNIX for Advanced & Expert Users | 3 | 05-12-2006 05:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Which field to match on really depends on which platform you are on and which ps options you are using -- these vary rather wildly. As such, good advice -- especially if the command name is short an cryptic, you might get accidental matches. As always, look before you dive. The use of [a]bc is a trick to avoid having the script find and kill itself in the listing; unlike "abc", "[a]bc" does not match itself, so it avoids this suicide syndrome. There are other ways to work around that, of course. Here's one attempt. Code:
ps -ef | awk '$9 == "a" "bc" { print $2 }' | xargs kill
Unlike a regular expression, which matches anywhere within a command name, this one requires the entirety of field 9 to be exactly equivalent to the concatenated string "abc". That may or may not be what you need, again depending on how the command was invoked and on how your version of ps shows the information. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|