Difference between ctrl+z, ctrl+c, ctrl+d in Linux

ctrl+c and ctrl+z are both interrupt commands, but their functions are different.

ctrl+c is to force the execution of the interrupt program, and the process has terminated.

ctrl+z is to suspend the task (meaning to suspend), but the task is not over, he is still in the process, he just maintains the suspended state, the user can use the fg/bg operation to continue the foreground or background task, fg command Restart the interrupted task in the foreground, and the bg command executes the interrupted task in the background.

For example: when you vi a file, if you need to use the shell to perform other operations, but you do not intend to close vi, because you have to save and exit, you can simply press ctrl+z, the shell will suspend the vi process~ , When you have finished that shell operation, you can use the fg command to continue vi your file.

Instead of sending a signal, ctrl-d represents a special binary value, which means EOF.
Note: In the shell, ctrl-d means to launch the current shell.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324493571&siteId=291194637