A Guide to Kill, Pkill and Killall Commands to Terminate a Process in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

31 Responses

  1. rajas says:

    how to avoid to kill any process. I mean suppose I do not want anybody to kill mysql service using kill command so how can I do this?

    Awaiting your reply,

    Rjas

    • Avishek Kumar says:

      @rajas,
      if the process was started with root privileged, it can not be killed by any user unless the user is sudoers.

  2. Cesar says:

    I have problems with chrome slowing down my system, so I’m used to kill all stances of chrome with this command:

    $ while [pidof chrome]; do killall chrome; done

  3. Sriram says:

    Hi,

    Can you please tell how to kill all the process running when i close the terminal/screen. Thanks.

    • Avishek Kumar says:

      Dear sriram,
      i Didn’t get you question.
      When you close a terminal. All the running processes gets killed except those running in background and you can kill those by finding their pid.

  4. tamal2015 says:

    hi…can u tell me the procedure to replace graphic card in red hat linux enterprise 6.0?…my pc was shipped with nvidia 610GT(zotac made GT610) but i need to replace it with nvidia 210GT(asus made En210). the second card is downgraded than the first one.Also can u inform me whether I need to do free OS install or not for this? ur kindness is appreciated on this!!!

    • Avishek Kumar says:

      I fear it would be built on the board and perhaps u cant swap it. Ask your Vendor for such detailed hardware information.

  5. linux fresher says:

    may god bless this website to me more powerful than RHKB. Please list out INterview section for new admins.

    • Avishek Kumar says:

      @ Linux Fresher, I didn’t get you properly, although as far as i could understand, you said words for Appraisals for us. Thanks

  6. Also xkill is the easiest way to kill a process using just your mouse.

    Just type ‘xkill’ in the terminal and then it would change the cursor to a cross, then just click on the process you want to kill and you are done. It is as easy as that.

    Please add this also. This is very useful in some really frustrating situations like stuck in the middle of a game, then just do Alt+Ctrl+T to bring up the terminal and kill the game using xkill.

    It has helped me quite a lot of times, it might help you also.

  7. ubungu says:

    Thank techmint for valuable posts :)

    Thank again for good tip :)

  8. akane says:

    DO NOT use kill to stop services as a first resort. This will mess up your system if you do it regularly. Use the init scripts already set up for that purpose, or whichever program is provided for control of the service.

    Normally, for example to stop rsyncd, you should use “/etc/init.d/rsync stop”. You can use the same script to start, restart, or get status of the service. Read the script to learn more about what it does.

    If you have Upstart installed, then the “service” command works similarly (but arguably better). The syntax is “service rsync restart” to restart rsyncd, for example. Currently Upstart does not support all services in Debian-based distros, so you might need to use the previous method.

    Many services come with their own maintenance programs separate from the init.d scripts. For example, apache2 httpd comes with apachectl.

    Finally, while the “kill” command is mostly used to stop processes, it can send *any* signal. Check out the manpage for more information. kill is much more useful than explained here- but also more dangerous.

    • Pawel says:

      Killall on Solaris will kill all processes on the system making it unusable.
      so it’s not a good habit to use killall. So use it with extreme care first check then use :-)

  9. siddiqullah says:

    i usually see interesting topics of linux in this site.i realy like this site ,because it gets me femiliar with linux and i have leant alot upto know.

    thanks

  10. Suvarna says:

    Really very helpful information. I will try to use this to decrease server load. Thank You Tecmint for sharing all valuable posts.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *