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...

32 Responses

  1. Artur says:

    In order to `kill skypeforlinux` I have used `killall skypeforlinux` two times (because of a wingpanel I believe), but now actually I use this pidof skypeforlinux | xargs kill -9 and it kills my skypeforlinux in one go :) . A good article.

  2. vivek says:

    I am using kill -9 $pid command to kill my server. However, sometimes if I restart the server, I get an exception as an address already in use that is the port is still in use (port number 6001) even after stopping the server using the above mentioned command.

    Is there any other safe command to use to kill my server so that the port is also freed along with killing of the process

    • Vladimir says:

      You can find PID-s of all processes on a port with command *lsof -i :6001*, where 6001 is a number of your port. Then you can kill all processes on that port with *kill* command.

  3. Carsten says:

    Thank u for this article :)

  4. Afsar says:

    Very good article, I can learn now easily..

  5. Mehmet Yesilçay says:

    thanks for sharing

  6. ymkim says:

    Thank you very much.
    I was able to solve my problem, thanks to you.
    “KamSaHamNiDa!!!”

  7. Martial says:

    Just to say thank you very much Avishek however I would like to know how the root can kill a specific process for an user, please can you give me with a scenario. Thanks again.

    • Ravi Saive says:

      @Martial,
      First find the all the processes and Process IDs of particular users by running following command.

      # ps -aux | grep {user}
      

      And then kill the specific process by their process ID’s

  8. Stig says:

    Thanks a lot! Great guide!

  9. Vijay says:

    Very nice

  10. Don Porter says:

    Something is messed up. I’ve installed Varnish 3.0 via apt-get install running Raspbian on my Pi 2. For some reason, my “service” commands don’t work. ” sudo service varnish start” yields “varnish: unrecognized service”. Please advise how I can straighten this out. Thanks very much.

Got something to say? Join the discussion.

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