Sponsored Content
Top Forums UNIX for Dummies Questions & Answers kill/pkill process by CMD info. Post 302334408 by mrwatkin on Wednesday 15th of July 2009 12:45:51 PM
Old 07-15-2009
kill/pkill process by CMD info.

I have a process that I'd like to kill. Doing a "ps -fu myusername" gives me:
Code:
UID           PID    PPID  C  STIME TTY     TIME         CMD
myusername    5443   1     0  10:05 ?       00:00:00     /bin/sh    /some/path/crap.sh  -s /yet/another/path/parentProcess
myusername    5593   5443  0  10:05 ?       00:00:00     /usr/java/jdk1.5/jre/bin/java  -somethingToDoWithParent

I'd like to be able to pkill or kill these two processes using a single command. The second process is the child process of the first. Using trial and error, I was able to kill just the parent process using:
Code:
ps -fp $(pgrep -u myusername crap)

I just don't know regular expressions to the point where I can single out this process by "parentProcess" because I think it's an argument and not the actual process name.

If anyone knows the correct command to kill the parent and child, I'd appreciate it. A little explanation of the command would be cool if you have the time. I think I'll be able to figure out any piping.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use Kill cmd when detect rogue

I'm system administrator and most of our Unix servers in the company host database that are accessed frequently by company employees. One day, one particular Unix server has been reported as being very slow. Upon further investigation using the ps command, we've found a rogue process that is... (8 Replies)
Discussion started by: agui
8 Replies

2. Shell Programming and Scripting

Is there any cmd to kill a process including its childs ( or sub processes spawned by

Dear Unix Gurus, Here is my query. If i start a script,it inturn calls many other scripts ..and most of them continue to run in parallel. Suppose,if i want to stop my script for some reason,i need to kill -9 each of the processes running.It becomes clumsy if the sub processes r more. ... (15 Replies)
Discussion started by: gvsreddy_539
15 Replies

3. UNIX for Dummies Questions & Answers

what is the cmd in gdb to know resource info

Hi All, I am running one exe file say xyz and it is executing some 300 files. This xyz hanges when it reach at file no 232. So I checked this particular file by putting in the beginning and it didnt hang at that file but hanaged again at file no 232. So i figure out its not a problem with xyz... (2 Replies)
Discussion started by: gauri
2 Replies

4. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

5. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

6. Solaris

Diffirence between Kill and Pkill Command???

Diffirence between Kill and Pkill Command??? (1 Reply)
Discussion started by: udayn
1 Replies

7. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

8. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

9. UNIX and Linux Applications

Unix pkill error; does wily obstruct me killing the process?

have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my stopper process. However I need WILY in this so I added it to my script but this time, a message... (1 Reply)
Discussion started by: nerdogan551
1 Replies

10. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies
KILL(1)                                                            User Commands                                                           KILL(1)

NAME
kill - send a signal to a process SYNOPSIS
kill [options] <pid> [...] DESCRIPTION
The default signal for kill is TERM. Use -l or -L to list available signals. Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0. Alternate signals may be specified in three ways: -9, -SIGKILL or -KILL. Negative PID values may be used to choose whole process groups; see the PGID column in ps command output. A PID of -1 is special; it indicates all processes except the kill process itself and init. OPTIONS
<pid> [...] Send signal to every <pid> listed. -<signal> -s <signal> --signal <signal> Specify the signal to be sent. The signal can be specified by using name or number. The behavior of signals is explained in sig- nal(7) manual page. -l, --list [signal] List signal names. This option has optional argument, which will convert signal number to signal name, or other way round. -L, --table List signal names in a nice table. NOTES Your shell (command line interpreter) may have a built-in kill command. You may need to run the command described here as /bin/kill to solve the conflict. EXAMPLES
kill -9 -1 Kill all processes you can kill. kill -l 11 Translate number 11 into a signal name. kill -L List the available signal choices in a nice table. kill 123 543 2341 3453 Send the default signal, SIGTERM, to all those processes. SEE ALSO
kill(2), killall(1), nice(1), pkill(1), renice(1), signal(7), skill(1) STANDARDS
This command meets appropriate standards. The -L flag is Linux-specific. AUTHOR
Albert Cahalan <albert@users.sf.net> wrote kill in 1999 to replace a bsdutils one that was not standards compliant. The util-linux one might also work correctly. REPORTING BUGS
Please send bug reports to <procps@freelists.org> procps-ng October 2011 KILL(1)
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy