To kill a hanging job, I use Ctrl+c, to send an interrupt signal to the hanging job. Sometimes this wouldn't stop the job, at least not immediately. I can then use Ctrl+z to suspend the job and then kill it with kill %1 (or whatever the number of the job is).

Why is Ctrl+z more powerful than Ctrl+c in interfering with a job? Sometimes, not even Ctrl+z works. Are there other key combinations one could use in such situations?

I tried stty -a, but none of the other listed key combinations do anything for me.


Ctrl+C (control character intr): It will send SIGINT signal to a process and usually application gets abort but the application can handle this signal. For example you can handle a signal with signal() function in C Language.

Ctrl+Z (control character susp): It will send SIGTSTP signal to a process to put it in background and like SIGINT it can be handle.

The process will not kill immediately with Ctrl+C if it has wait I/O and you have to wait to finish its I/O and then the application will terminate from memory. ‌
But Ctrl+Z will pause your process and its I/Os. Technically the operating system will not give it CPU time and if you kill the background process, it may lose some I/O and data.

For force killing a process you have to SIGKILL or signal number 9 which is most powerful signal - the operating system will kill it immediately, but you may lose data, as the program will have no way to react to this signal.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.