Solved

Linux, pkill

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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 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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

747 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

13 Experts available now in Live!

Get 1:1 Help Now