How can I disable the key combination Ctrl+C on GNU-screen? Actually I would have to get used to it, but I press Ctrl+C rather than Ctrl+A+D out of habit.
Ctrl+C sends the
INT (interrupt) signal to the process currently in the foreground. This is an important signal to be able to send, so the best thing would be to just learn not to press that key combination by mistake.
You can also remap that key combination so that you have another control sequence that sends the
INT signal. For example, you may make Ctrl+G do the same thing with the shell command
stty intr ^G
The Ctrl+C key combination will then just send a character with ASCII code 3.
Again, it would probably be less problematic to just learn to use Ctrl+C correctly.
Now I've found the answer myself. The instructions
defscrollback 30000 bindkey "^C" echo 'Blocked. Please use [Ctrl]+[A] + [Ctrl]+[Enter] + [Y]' bindkey "^D" echo 'Blocked. Please use [Ctrl]+[A] + [Ctrl]+[Enter] + [Y]' bind "^M" quit
in the file
lead to the fact that C-c only executes the
echo command, thus no longer sends an interrupt. The advantage of this solution is that I don't have to change the actual Java or Python program. Please remember that running screen sessions must be restarted in order to read the new
~/.screenrc file. (This path depends on the user, e.g.
- Screen version 4.01.00devel (GNU) 2-May-06
- Ubuntu 14.04.5 LTS
- MobaXterm v10.9 Build 3656 (Windows)