Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of ctrl c in command to cancel a program

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?

like image 790
Eduardo Avatar asked Feb 05 '09 06:02

Eduardo


People also ask

Which command is used to stop a program process?

Ctrl + C should stop a program running from the command prompt, similar to linux.

How do I terminate a program in terminal?

Ctrl-b + :kill-session kills the current session.

How do I stop a C program from running in terminal?

How to Stop a C program in Terminal when running? If you run your C or C++ app in Command Prompt, and it is in loop or you want to end this running program, just press Ctrl+C to end the app.


1 Answers

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.

like image 190
Firas Assaad Avatar answered Sep 28 '22 05:09

Firas Assaad