Solved

Linux, pkill

Posted on 2013-05-24
4
517 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Backup & Restore 3 54
Adding more CPU cores to a Linux VM 5 93
Setting up two Raspberry Pi gateways/routers 3 60
awk to variable in bash 2 40
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Fine Tune your automatic Updates for Ubuntu / Debian
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

813 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

16 Experts available now in Live!

Get 1:1 Help Now