Linux, pkill

Posted on 2013-05-24
Medium Priority
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 ?

Question by:Los Angeles1
LVL 32

Accepted Solution

serialband earned 500 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.
LVL 21

Assisted Solution

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

Try tighten down process name -

pkill xxxxjavaxxxx

Open in new window

LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 500 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.
LVL 40

Assisted Solution

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

    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


Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

597 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