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.

3 Answers 3


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. Instead you can stop the screen with ^M or Ctrl+Enter. Because I use bind (unlike bindkey) you have to press C-a first. The confirmation prompt can be confirmed with Y. 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. /root/.screenrc or /home/user/.screenrc.)

Helpful links:

Tested with

  • Screen version 4.01.00devel (GNU) 2-May-06
  • Ubuntu 14.04.5 LTS
  • MobaXterm v10.9 Build 3656 (Windows)

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.

  • Thank you. I'll take care of it. Unfortunately I can only use your command outside of screen. A Java or Python program runs inside. I have already pressed the wrong key combination so often that I have to do something. ;)
    – uav
    Commented Dec 17, 2018 at 11:06
  • @uav Ah. If you are able to modify the code of the program, you could make it ignore the INT signal completely.
    – Kusalananda
    Commented Dec 17, 2018 at 11:20
  • That is possible, but I have posted a more general answer. ;)
    – uav
    Commented Dec 17, 2018 at 16:03

You can avoid this issue in the first place by using logging as follows:

  1. While creating the screen, use this command to generate a log file:
screen -L -Logfile file_name.log
  1. Now, to check the screen, do not resume it; instead read the log file interactively, with one of these two commands:
tail -f -n 20 file_name.log
watch tail file_name.log

Hope this helps.

  • Well, just as I have the habit of pressing [Ctrl]+[C], I have the habit of going in with screen -r, so your solution is only something for disciplined people - who don't exist. ;) My point is not to avoid the error, but to prevent it. ;D
    – uav
    Commented Jul 26, 2021 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .