Is there a "Super" break key for bash?
The super key is closing the terminal. :-) That, or the power button on your computer.
Each of the key combinations Ctrl+c, Ctrl+x, Ctrl+z, and Ctrl+d does a different thing.
Ctrl+c : generates an interrupt signal (SIGINT).
Ctrl+x : I'm not sure what this does.
Ctrl+z : suspend the process, allowing it to be resumed at a later point (SIGSTOP).
Ctrl+d : sends an end-of-file (EOF) character.
Each process is at liberty to interpret these signals as they see fit. Hence, there is some heterogeneity in the response.
A more generic way to terminate a process would be to kill it with a SIGKILL signal, the most aggressive way, which is which (I think) is the same as closing the terminal window. It's better to attempt Ctrl+d and Ctrl+c first though, because these are signals that the process can anticipate, allowing it to end in a predictable and safer way.
Check the manual page with man 7 signal
.
Related videos on Youtube
Meer Borg
Updated on September 18, 2022Comments
-
Meer Borg over 1 year
When using terminal sometimes you need to break the program. Sometimes you press Ctrl-c sometimes Ctrl-x and sometimes Ctrl-z
In some circumstances, it might simply be closing a quote or pressing enter a few times there are even instances when Ctrl-d will work.
So when I get stuck, like an idiot, I start mashing those keys like an idiot in the hope that the process will quit. In 95% of the cases it works and when I get desperate I just close the terminal and that works 100% of the time. I'm sure there is a logical reason for the various states due to the program being in a particular state but all I want to do is just break the application and return to the bash prompt.
Is there a super key that will break the process without having to mash these 4 magic keys in the hope that the application will terminate?
-
Meer Borg about 11 yearsctr-z suspend, didnt know that, how do you resume?
-
Meer Borg about 11 yearsThanks, i normally use screen command for that, always wanted to know why when exiting terminal it said there were running jobs, now I know, pressed ctr-z wrongly sending it to background instead of terminating
-
Sparhawk about 11 years@ScottSeverance Yeah, I didn't really go into SIGTERM, but I suspect that SIGINT (
Ctrl
+c
) or EOF (Ctrl
+d
) are even safer? But yes, I agree that SIGTERM is better than SIGKILL. -
Pablo Bianchi over 5 yearsRead this sad story about why you shouldn't use SIGKILL if not necessary.