Question: Ctrl-z and ctrl-c difference?
Reply:
Ctrl-z and Ctrl-c are both interrupt commands, but their role is different.
Ctrl-c is the execution of a forced interrupt program,
And Ctrl-z is the task is interrupted, but this task does not end, he is still in the process he just maintain a suspended state, the user can use the FG/BG operation to continue the foreground or background tasks, FG command Restart the foreground interrupted task, BG command to put the interrupted task in the background execution.
For example:
When you vi a file is, if you need to do other operations with the shell, but you do not want to shut down VI, because you have to
To save the launch, you can simply press Ctrl-z,shell will suspend the VI process ~, when you end the shell operation, you can use the FG command to continue vi your file. Isn't it convenient?
Summarize:
(1) Ctrl + Z Stop the process and put in the background
(2) Jobs shows the currently paused process
(3) BG%N enables the nth task to run in the background (with a space before%)
(4) FG%N to enable nth tasks to run in the foreground
The default BG,FG indicates the last process action without%n!
====
Linux: Ctrl-c sends SIGINT signals to all processes in the foreground process group. is often used to terminate a running program. Ctrl-z sends a SIGTSTP signal to all processes in the foreground process group, which is often used to suspend a process. Instead of sending a signal, ctrl-d represents a special binary value, which is a table
Under Linux:
Ctrl-c sends a SIGINT signal to all processes in the foreground process group. is often used to terminate a running program.
Ctrl-z sends a SIGTSTP signal to all processes in the foreground process group, which is often used to suspend a process.
Instead of sending a signal, ctrl-d represents a special binary value that represents EOF.
Ctrl-\ sends a sigquit signal to all processes in the foreground process group, terminates the foreground process, and generates a core file.
Key Function
Ctrl-c Kill Foreground process
Ctrl-z Suspend Foreground process
ctrl-d Terminate input, or exit shell
Ctrl-s Suspend Output
Ctrl-q Resume Output
Ctrl-o Discard Output
Ctrl-l Clear Screen
The difference between Linux CTRL + C and CTRL + Z