Eduardo Eduardo - 2 months ago 11
Linux Question

Equivalent of ctrl c in command to cancel a program

I am running a long 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 using 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 do ctrl c.

My question is: is there any way to do in a remote way the equivalent of ctrl c?.

Answer

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.