How to force a PID to terminate?

13,000

kill -KILL $PID or kill -9 $PID will forcibly terminate $PID, unless you don't have the permissions to do so (i.e., it belongs to a different user and you're not root), but be very careful with it. Inflicting it on a process will prevent it from doing any kind of filesystem (or other) cleanup.

Share:
13,000

Related videos on Youtube

voices
Author by

voices

Updated on September 18, 2022

Comments

  • voices
    voices over 1 year

    Yes, I've tried all the basic kill, pkill, etc. methods that come up with a Google search.
    Sometimes it works, other times it seems something is preventing the process from terminating.
    There is no stderr message when the kill command fails, but ps, pgrep, etc. show the process is still running.

    Is there a more forceful way to do this? Thanks.

    • Amit24x7
      Amit24x7 almost 7 years
      Try kill -9 <PID>
    • voices
      voices almost 7 years
      First thing I tried. I thought it would work too, but no such luck in this instance, unfortunately.
    • terdon
      terdon almost 7 years
      OK, what happened when you tried? Did you get an error message? Nothing? What does the output of ps show for this process? Please edit your question and add this information.
    • terdon
      terdon almost 7 years
      Yes, but can you please show us the output of ps so we can see what it reports for the process? Also, if you've tried kill -9 and that also fails, add that to your question too. The more detail you give, the more likely it is that we'll be able to answer.
    • voices
      voices almost 7 years
      @terdon No, I can't.
  • EightBitTony
    EightBitTony almost 7 years
    It's worth remembering that kill -9 might not always stop the process in the time frame you would like - unix.stackexchange.com/questions/5642/…
  • voices
    voices almost 7 years
    Yep, tried that.