Equivalent of ctrl c in command to cancel a program

Eduardo picture Eduardo · Feb 5, 2009 · Viewed 77k times · Source

I am running a long linux program in a remote machine, and I want to stop it, but my problem is that if I use the kill command then the program will exit without saving results. Normally what I do to finish the program is use Ctrl+C and in that case the program saves the results, but right now I am not in the machine that is running the session so I cannot press Ctrl+C.

My question is: is there any way to do in a remote way the equivalent of Ctrl+C?

Answer

Firas Assaad picture Firas Assaad · Feb 5, 2009

Try:

kill -SIGINT processPIDHere

Basically Ctrl C sends the SIGINT (interrupt) signal while kill sends the SIGTERM (termination) signal by default unless you specify the signal to send.