Difference Between Ctrl+Z And Ctrl+C on Linux Command - Fosslicious

Friday, May 11, 2018

Difference Between Ctrl+Z And Ctrl+C on Linux Command

Have you ever done those two commands to stop a process that is still running on the CLI / terminal? I've tried both. But these two commands have different ways of working. Although in fact, the two commands have in common that is to stop the process. The difference is:

1. Ctrl+Z

when using this command, we will stop, in the running process, but the process is not completely stopped, in other words we can continue the process we stop with this command. In this case, the example is when running an application via a terminal. I will try to stop the process. And the result as shown below:
Ctrl+Z Command
There is a description of stopp [1], which means, there is 1 process that is stopped. And the process can be continued by typing the fg command in the terminal. And you can see in the picture below, the process I stopped earlier, now continues again.
fg command on linux
 
So you need to know function 2 of this command, for ctrl + z, this command is only used to suspend the process, and can be resumed.



2. Ctrl+C

Ctrl + C Command on Linux


This command has a difference with ctrl + z, this command will cancel the running process, if we press the combination ctrl + C will immediately cancel it. So you will not be able to continue a process that is stopped with this command. You can see in the picture below, When I press the combination ctrl + c will see the description that the running process has been canceled, inside the terminal there is the word "Abort".

both orders, can be used to adjust the conditions. Remember! from now on, to cancel the process, please press ctrl + C. May be useful. CMIIW