Disable Ctrl+C in GNU screen?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1














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.










share|improve this question













migrated from serverfault.com Dec 14 at 21:05


This question came from our site for system and network administrators.



















    1














    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.










    share|improve this question













    migrated from serverfault.com Dec 14 at 21:05


    This question came from our site for system and network administrators.

















      1












      1








      1







      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.










      share|improve this question













      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.







      linux gnu-screen






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 14 at 17:17









      uav

      14710




      14710




      migrated from serverfault.com Dec 14 at 21:05


      This question came from our site for system and network administrators.






      migrated from serverfault.com Dec 14 at 21:05


      This question came from our site for system and network administrators.






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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.






          share|improve this answer




















          • 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
            Dec 17 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
            Dec 17 at 11:20










          • That is possible, but I have posted a more general answer. ;)
            – uav
            Dec 17 at 16:03


















          0














          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



          ~/.screenrc


          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. /root/.screenrc or /home/user/.screenrc.)



          Helpful links:



          • http://web.mit.edu/gnu/doc/html/screen_13.html

          • https://unix.stackexchange.com/a/116588/239596

          Tested with



          • Screen version 4.01.00devel (GNU) 2-May-06

          • Ubuntu 14.04.5 LTS

          • MobaXterm v10.9 Build 3656 (Windows)





          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488059%2fdisable-ctrlc-in-gnu-screen%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            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.






            share|improve this answer




















            • 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
              Dec 17 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
              Dec 17 at 11:20










            • That is possible, but I have posted a more general answer. ;)
              – uav
              Dec 17 at 16:03















            2














            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.






            share|improve this answer




















            • 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
              Dec 17 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
              Dec 17 at 11:20










            • That is possible, but I have posted a more general answer. ;)
              – uav
              Dec 17 at 16:03













            2












            2








            2






            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.






            share|improve this answer












            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 14 at 21:25









            Kusalananda

            121k16229372




            121k16229372











            • 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
              Dec 17 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
              Dec 17 at 11:20










            • That is possible, but I have posted a more general answer. ;)
              – uav
              Dec 17 at 16:03
















            • 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
              Dec 17 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
              Dec 17 at 11:20










            • That is possible, but I have posted a more general answer. ;)
              – uav
              Dec 17 at 16:03















            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
            Dec 17 at 11:06




            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
            Dec 17 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
            Dec 17 at 11:20




            @uav Ah. If you are able to modify the code of the program, you could make it ignore the INT signal completely.
            – Kusalananda
            Dec 17 at 11:20












            That is possible, but I have posted a more general answer. ;)
            – uav
            Dec 17 at 16:03




            That is possible, but I have posted a more general answer. ;)
            – uav
            Dec 17 at 16:03













            0














            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



            ~/.screenrc


            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. /root/.screenrc or /home/user/.screenrc.)



            Helpful links:



            • http://web.mit.edu/gnu/doc/html/screen_13.html

            • https://unix.stackexchange.com/a/116588/239596

            Tested with



            • Screen version 4.01.00devel (GNU) 2-May-06

            • Ubuntu 14.04.5 LTS

            • MobaXterm v10.9 Build 3656 (Windows)





            share|improve this answer



























              0














              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



              ~/.screenrc


              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. /root/.screenrc or /home/user/.screenrc.)



              Helpful links:



              • http://web.mit.edu/gnu/doc/html/screen_13.html

              • https://unix.stackexchange.com/a/116588/239596

              Tested with



              • Screen version 4.01.00devel (GNU) 2-May-06

              • Ubuntu 14.04.5 LTS

              • MobaXterm v10.9 Build 3656 (Windows)





              share|improve this answer

























                0












                0








                0






                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



                ~/.screenrc


                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. /root/.screenrc or /home/user/.screenrc.)



                Helpful links:



                • http://web.mit.edu/gnu/doc/html/screen_13.html

                • https://unix.stackexchange.com/a/116588/239596

                Tested with



                • Screen version 4.01.00devel (GNU) 2-May-06

                • Ubuntu 14.04.5 LTS

                • MobaXterm v10.9 Build 3656 (Windows)





                share|improve this answer














                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



                ~/.screenrc


                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. /root/.screenrc or /home/user/.screenrc.)



                Helpful links:



                • http://web.mit.edu/gnu/doc/html/screen_13.html

                • https://unix.stackexchange.com/a/116588/239596

                Tested with



                • Screen version 4.01.00devel (GNU) 2-May-06

                • Ubuntu 14.04.5 LTS

                • MobaXterm v10.9 Build 3656 (Windows)






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 18 at 17:38

























                answered Dec 17 at 16:02









                uav

                14710




                14710



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f488059%2fdisable-ctrlc-in-gnu-screen%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown






                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?