Solved

Linux, pkill

Posted on 2013-05-24
4
511 Views
Last Modified: 2013-05-24
If I issue the following command

   pkill java

Will that kill all the java processes I have running, or just one

Will it kill anothy other than a java process ?

Thanks
0
Comment
Question by:Los Angeles1
4 Comments
 
LVL 28

Accepted Solution

by:
serialband earned 125 total points
ID: 39195761
It should kill all of processes that match the pattern java.

So if you have a processes name java, javac, and newjava, they will all be killed.
0
 
LVL 21

Assisted Solution

by:Mazdajai
Mazdajai earned 125 total points
ID: 39195768
All process contains the word "java".

Try tighten down process name -

pkill xxxxjavaxxxx

Open in new window

0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 125 total points
ID: 39195803
It will kill All processes with a name "java" . But I doubt this is what you want. Will you please explain what is that you want to achieve?

I suggest you to run the command as
pkill -9 java

Open in new window



To make sure that the kill request was not masked.
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 125 total points
ID: 39195936
As the man page says:


"pattern
    Specifies an Extended Regular Expression for matching against the process names or command lines."

This means that it will match with process name or command line.

Also quoting from links below:

"Pkill Example:

Before sending signal, you can verify which are all the process is matching the criteria using “pgrep -l”, which displays the process ID and process name of the matching processes."


Normal users may kill their processes only. root can kill others processes as well.

Please see links below

http://unix.stackexchange.com/questions/23930/how-to-pkill-by-command-name
http://www.thegeekstuff.com/2009/12/4-ways-to-kill-a-process-kill-killall-pkill-xkill/
http://www.linuxintheshell.org/2012/12/18/episode-20-pgrep-and-pkill/
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 73
Edit linux file using python 4 40
LINUX CENTOS + APACHE 9 61
How code a 301 redirect for folder files -> 1 file 2 18
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now