How to remotely detach a screen from another terminal

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











up vote
2
down vote

favorite












So I have 2 terminals open in front of me;



  1. /dev/pts/1 - 'the controller'

  2. /dev/pts/2 - 'the receiver'

I am currently using ttyecho to execute commands in /pts2 from /pts1.

I can list the screens - ttyecho -n /dev/pts/2 screen -ls fine from /pts1 and see the results in /pts2.

I can attach to a screen ttyecho -n /dev/pts/2 screen -x [blah] from /pts1 on /pts2 fine.. But what I can't do, is when attached to a screen then detach from it.



So if /dev/pts/2 is then inside a screen, I am trying to detach from it by executing a command using ttyecho from /dev/pts1



I've tried sending...



ttyecho -n /dev/pts/2 ^a+d 
ttyecho -n /dev/pts/2 screen -d -r
ttyecho -n /dev/pts/2 screen -D -RR
ttyecho -n /dev/pts/2 screen -d -r
ttyecho -n /dev/pts/2 screen -DRi
ttyecho -n /dev/pts/2 Ctrl+a+d
ttyecho -n /dev/pts/2 Ctrl+a d
ttyecho -n /dev/pts/2 CTRL + A
ttyecho -n /dev/pts/2 control+a


So I guess what I need is either:



  • A command I can send that will detach the screen OR

  • Someway to send some kind of pseudo keyboard commands via ttyecho to that other screen to detach it.

Any help most appreciated.







share|improve this question


























    up vote
    2
    down vote

    favorite












    So I have 2 terminals open in front of me;



    1. /dev/pts/1 - 'the controller'

    2. /dev/pts/2 - 'the receiver'

    I am currently using ttyecho to execute commands in /pts2 from /pts1.

    I can list the screens - ttyecho -n /dev/pts/2 screen -ls fine from /pts1 and see the results in /pts2.

    I can attach to a screen ttyecho -n /dev/pts/2 screen -x [blah] from /pts1 on /pts2 fine.. But what I can't do, is when attached to a screen then detach from it.



    So if /dev/pts/2 is then inside a screen, I am trying to detach from it by executing a command using ttyecho from /dev/pts1



    I've tried sending...



    ttyecho -n /dev/pts/2 ^a+d 
    ttyecho -n /dev/pts/2 screen -d -r
    ttyecho -n /dev/pts/2 screen -D -RR
    ttyecho -n /dev/pts/2 screen -d -r
    ttyecho -n /dev/pts/2 screen -DRi
    ttyecho -n /dev/pts/2 Ctrl+a+d
    ttyecho -n /dev/pts/2 Ctrl+a d
    ttyecho -n /dev/pts/2 CTRL + A
    ttyecho -n /dev/pts/2 control+a


    So I guess what I need is either:



    • A command I can send that will detach the screen OR

    • Someway to send some kind of pseudo keyboard commands via ttyecho to that other screen to detach it.

    Any help most appreciated.







    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      So I have 2 terminals open in front of me;



      1. /dev/pts/1 - 'the controller'

      2. /dev/pts/2 - 'the receiver'

      I am currently using ttyecho to execute commands in /pts2 from /pts1.

      I can list the screens - ttyecho -n /dev/pts/2 screen -ls fine from /pts1 and see the results in /pts2.

      I can attach to a screen ttyecho -n /dev/pts/2 screen -x [blah] from /pts1 on /pts2 fine.. But what I can't do, is when attached to a screen then detach from it.



      So if /dev/pts/2 is then inside a screen, I am trying to detach from it by executing a command using ttyecho from /dev/pts1



      I've tried sending...



      ttyecho -n /dev/pts/2 ^a+d 
      ttyecho -n /dev/pts/2 screen -d -r
      ttyecho -n /dev/pts/2 screen -D -RR
      ttyecho -n /dev/pts/2 screen -d -r
      ttyecho -n /dev/pts/2 screen -DRi
      ttyecho -n /dev/pts/2 Ctrl+a+d
      ttyecho -n /dev/pts/2 Ctrl+a d
      ttyecho -n /dev/pts/2 CTRL + A
      ttyecho -n /dev/pts/2 control+a


      So I guess what I need is either:



      • A command I can send that will detach the screen OR

      • Someway to send some kind of pseudo keyboard commands via ttyecho to that other screen to detach it.

      Any help most appreciated.







      share|improve this question














      So I have 2 terminals open in front of me;



      1. /dev/pts/1 - 'the controller'

      2. /dev/pts/2 - 'the receiver'

      I am currently using ttyecho to execute commands in /pts2 from /pts1.

      I can list the screens - ttyecho -n /dev/pts/2 screen -ls fine from /pts1 and see the results in /pts2.

      I can attach to a screen ttyecho -n /dev/pts/2 screen -x [blah] from /pts1 on /pts2 fine.. But what I can't do, is when attached to a screen then detach from it.



      So if /dev/pts/2 is then inside a screen, I am trying to detach from it by executing a command using ttyecho from /dev/pts1



      I've tried sending...



      ttyecho -n /dev/pts/2 ^a+d 
      ttyecho -n /dev/pts/2 screen -d -r
      ttyecho -n /dev/pts/2 screen -D -RR
      ttyecho -n /dev/pts/2 screen -d -r
      ttyecho -n /dev/pts/2 screen -DRi
      ttyecho -n /dev/pts/2 Ctrl+a+d
      ttyecho -n /dev/pts/2 Ctrl+a d
      ttyecho -n /dev/pts/2 CTRL + A
      ttyecho -n /dev/pts/2 control+a


      So I guess what I need is either:



      • A command I can send that will detach the screen OR

      • Someway to send some kind of pseudo keyboard commands via ttyecho to that other screen to detach it.

      Any help most appreciated.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 9 at 14:49









      Jeff Schaller

      31.3k846105




      31.3k846105










      asked Feb 9 at 1:42









      AndreeCrist

      1133




      1133




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          You can do



          $ screen -ls


          This will list all the screen sessions like this.



          There are screens on:
          8365.pts-6.vm2 (Attached)
          7317.pts-1.vm2 (Attached)
          2 Sockets in /var/run/screen/S-root.


          Then you can detach any screen session with the help of screen id.



          For eg:



          $ screen -d 8365
          [8365.pts-6.vm2 detached.]





          share|improve this answer



























            up vote
            3
            down vote













            There’s no need to use ttyecho to detach the screen session, you can ask screen to do it for you:



            screen -d pts-2


            This will detach the session matching the name “pts-2”, which by default would match a screen session started on pts/2.






            share|improve this answer






















            • Genius, easy when you know how. Thanks Stephen
              – AndreeCrist
              Feb 9 at 7:16










            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f422949%2fhow-to-remotely-detach-a-screen-from-another-terminal%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            You can do



            $ screen -ls


            This will list all the screen sessions like this.



            There are screens on:
            8365.pts-6.vm2 (Attached)
            7317.pts-1.vm2 (Attached)
            2 Sockets in /var/run/screen/S-root.


            Then you can detach any screen session with the help of screen id.



            For eg:



            $ screen -d 8365
            [8365.pts-6.vm2 detached.]





            share|improve this answer
























              up vote
              1
              down vote



              accepted










              You can do



              $ screen -ls


              This will list all the screen sessions like this.



              There are screens on:
              8365.pts-6.vm2 (Attached)
              7317.pts-1.vm2 (Attached)
              2 Sockets in /var/run/screen/S-root.


              Then you can detach any screen session with the help of screen id.



              For eg:



              $ screen -d 8365
              [8365.pts-6.vm2 detached.]





              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                You can do



                $ screen -ls


                This will list all the screen sessions like this.



                There are screens on:
                8365.pts-6.vm2 (Attached)
                7317.pts-1.vm2 (Attached)
                2 Sockets in /var/run/screen/S-root.


                Then you can detach any screen session with the help of screen id.



                For eg:



                $ screen -d 8365
                [8365.pts-6.vm2 detached.]





                share|improve this answer












                You can do



                $ screen -ls


                This will list all the screen sessions like this.



                There are screens on:
                8365.pts-6.vm2 (Attached)
                7317.pts-1.vm2 (Attached)
                2 Sockets in /var/run/screen/S-root.


                Then you can detach any screen session with the help of screen id.



                For eg:



                $ screen -d 8365
                [8365.pts-6.vm2 detached.]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 9 at 9:57









                Abhi1227

                1511




                1511






















                    up vote
                    3
                    down vote













                    There’s no need to use ttyecho to detach the screen session, you can ask screen to do it for you:



                    screen -d pts-2


                    This will detach the session matching the name “pts-2”, which by default would match a screen session started on pts/2.






                    share|improve this answer






















                    • Genius, easy when you know how. Thanks Stephen
                      – AndreeCrist
                      Feb 9 at 7:16














                    up vote
                    3
                    down vote













                    There’s no need to use ttyecho to detach the screen session, you can ask screen to do it for you:



                    screen -d pts-2


                    This will detach the session matching the name “pts-2”, which by default would match a screen session started on pts/2.






                    share|improve this answer






















                    • Genius, easy when you know how. Thanks Stephen
                      – AndreeCrist
                      Feb 9 at 7:16












                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    There’s no need to use ttyecho to detach the screen session, you can ask screen to do it for you:



                    screen -d pts-2


                    This will detach the session matching the name “pts-2”, which by default would match a screen session started on pts/2.






                    share|improve this answer














                    There’s no need to use ttyecho to detach the screen session, you can ask screen to do it for you:



                    screen -d pts-2


                    This will detach the session matching the name “pts-2”, which by default would match a screen session started on pts/2.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 9 at 8:02

























                    answered Feb 9 at 5:12









                    Stephen Kitt

                    142k22308369




                    142k22308369











                    • Genius, easy when you know how. Thanks Stephen
                      – AndreeCrist
                      Feb 9 at 7:16
















                    • Genius, easy when you know how. Thanks Stephen
                      – AndreeCrist
                      Feb 9 at 7:16















                    Genius, easy when you know how. Thanks Stephen
                    – AndreeCrist
                    Feb 9 at 7:16




                    Genius, easy when you know how. Thanks Stephen
                    – AndreeCrist
                    Feb 9 at 7:16












                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f422949%2fhow-to-remotely-detach-a-screen-from-another-terminal%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

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

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay