3

I stopped using the Unix process ctr + z. Then I tried to kill the process and did not work. A friend from school was recommended to use the kill -9 process_id. What is the magic combination?

migrated from stackoverflow.com May 18 '11 at 15:38

This question came from our site for professional and enthusiast programmers.

  • should go on superuser. – Claudiu May 18 '11 at 15:37
  • Never trust "friend from school" recommendations, kill -9 process_id is quite a poor practice. – jlliagre May 18 '11 at 20:19
  • @jlliagre so what would you suggest as the correct practice? – slotishtype Jul 16 '11 at 11:56
  • "-9" or more precisely SIGKILL is a last resort signal, not something to routinely use. The correct practice for a suspended process is to first resume it as already answered. Should you want to kill it then, start by sending the "-15" signal (a.k.a SIGTERM) which give a chance for the process to exit gracefully. – jlliagre Jul 16 '11 at 14:20
8

Just follow normal kill by a resume (SIGCONT or in shell, fg the job).

The signal will only be received after the process is resumed (it cannot receive the signal because... you suspended it :))

So,

kill -CONT $pid

to resume it if you no longer have access to the terminal or shell controlling the job

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy