How to exit nano from a different terminal?

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











up vote
2
down vote

favorite












I was ssh'ing into a Raspberry Pi running Raspbian, editing a file with nano, when I lost my internet connection (by leaving the WiFi zone). After reconnecting an hour later, I found that the pi had kicked me out, but after logging back in, I saw that it did not stop the task. When I reopened nano, it told me that the file was being edited by the previous nano process, and it gave me the PID. I made substantial changes to the file and forgot to save, but presumably the changes are still there.



How can I tell nano to save & quit (^O -> Enter -> ^X) or reopen the task in a new shell, from outside the original process?







share|improve this question















  • 3




    It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
    – cunninghamp3
    May 3 at 21:12






  • 1




    One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
    – Jeff Schaller
    May 3 at 21:16










  • maybe this link will help you : unix.stackexchange.com/questions/31824/…
    – D'Arcy Nader
    May 3 at 21:16











  • I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
    – OldBunny2800
    May 3 at 21:17











  • I would, but cannot right now. Please feel free to do so yourself.
    – Jeff Schaller
    May 3 at 21:33














up vote
2
down vote

favorite












I was ssh'ing into a Raspberry Pi running Raspbian, editing a file with nano, when I lost my internet connection (by leaving the WiFi zone). After reconnecting an hour later, I found that the pi had kicked me out, but after logging back in, I saw that it did not stop the task. When I reopened nano, it told me that the file was being edited by the previous nano process, and it gave me the PID. I made substantial changes to the file and forgot to save, but presumably the changes are still there.



How can I tell nano to save & quit (^O -> Enter -> ^X) or reopen the task in a new shell, from outside the original process?







share|improve this question















  • 3




    It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
    – cunninghamp3
    May 3 at 21:12






  • 1




    One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
    – Jeff Schaller
    May 3 at 21:16










  • maybe this link will help you : unix.stackexchange.com/questions/31824/…
    – D'Arcy Nader
    May 3 at 21:16











  • I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
    – OldBunny2800
    May 3 at 21:17











  • I would, but cannot right now. Please feel free to do so yourself.
    – Jeff Schaller
    May 3 at 21:33












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I was ssh'ing into a Raspberry Pi running Raspbian, editing a file with nano, when I lost my internet connection (by leaving the WiFi zone). After reconnecting an hour later, I found that the pi had kicked me out, but after logging back in, I saw that it did not stop the task. When I reopened nano, it told me that the file was being edited by the previous nano process, and it gave me the PID. I made substantial changes to the file and forgot to save, but presumably the changes are still there.



How can I tell nano to save & quit (^O -> Enter -> ^X) or reopen the task in a new shell, from outside the original process?







share|improve this question











I was ssh'ing into a Raspberry Pi running Raspbian, editing a file with nano, when I lost my internet connection (by leaving the WiFi zone). After reconnecting an hour later, I found that the pi had kicked me out, but after logging back in, I saw that it did not stop the task. When I reopened nano, it told me that the file was being edited by the previous nano process, and it gave me the PID. I made substantial changes to the file and forgot to save, but presumably the changes are still there.



How can I tell nano to save & quit (^O -> Enter -> ^X) or reopen the task in a new shell, from outside the original process?









share|improve this question










share|improve this question




share|improve this question









asked May 3 at 20:58









OldBunny2800

1415




1415







  • 3




    It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
    – cunninghamp3
    May 3 at 21:12






  • 1




    One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
    – Jeff Schaller
    May 3 at 21:16










  • maybe this link will help you : unix.stackexchange.com/questions/31824/…
    – D'Arcy Nader
    May 3 at 21:16











  • I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
    – OldBunny2800
    May 3 at 21:17











  • I would, but cannot right now. Please feel free to do so yourself.
    – Jeff Schaller
    May 3 at 21:33












  • 3




    It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
    – cunninghamp3
    May 3 at 21:12






  • 1




    One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
    – Jeff Schaller
    May 3 at 21:16










  • maybe this link will help you : unix.stackexchange.com/questions/31824/…
    – D'Arcy Nader
    May 3 at 21:16











  • I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
    – OldBunny2800
    May 3 at 21:17











  • I would, but cannot right now. Please feel free to do so yourself.
    – Jeff Schaller
    May 3 at 21:33







3




3




It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
– cunninghamp3
May 3 at 21:12




It's unlikely you'll be able to reattach to that session, or send it anything meaningful. If nano 'knows' that the file is open, there's a good chance that the temporary save has been written somewhere and this serverfault answer may be how you are required to resolve this: serverfault.com/questions/453703/…
– cunninghamp3
May 3 at 21:12




1




1




One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
– Jeff Schaller
May 3 at 21:16




One of nano’s online man pages indicates it will write buffers out to files named nano.save if it receives a HUP or TERM signal. Test on an innocent file first!
– Jeff Schaller
May 3 at 21:16












maybe this link will help you : unix.stackexchange.com/questions/31824/…
– D'Arcy Nader
May 3 at 21:16





maybe this link will help you : unix.stackexchange.com/questions/31824/…
– D'Arcy Nader
May 3 at 21:16













I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
– OldBunny2800
May 3 at 21:17





I see a <myfile.py.save> file in my directory, thanks @JeffSchaller, would you like to write an answer?
– OldBunny2800
May 3 at 21:17













I would, but cannot right now. Please feel free to do so yourself.
– Jeff Schaller
May 3 at 21:33




I would, but cannot right now. Please feel free to do so yourself.
– Jeff Schaller
May 3 at 21:33










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










In the comments, @JeffSchaller noted that a terminated nano process saves the unwritten file in file_path.extension.save.



If it is there, which it was for me, it is a simple matter of mving the file into its original name.






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',
    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%2f441660%2fhow-to-exit-nano-from-a-different-terminal%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    In the comments, @JeffSchaller noted that a terminated nano process saves the unwritten file in file_path.extension.save.



    If it is there, which it was for me, it is a simple matter of mving the file into its original name.






    share|improve this answer

























      up vote
      3
      down vote



      accepted










      In the comments, @JeffSchaller noted that a terminated nano process saves the unwritten file in file_path.extension.save.



      If it is there, which it was for me, it is a simple matter of mving the file into its original name.






      share|improve this answer























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        In the comments, @JeffSchaller noted that a terminated nano process saves the unwritten file in file_path.extension.save.



        If it is there, which it was for me, it is a simple matter of mving the file into its original name.






        share|improve this answer













        In the comments, @JeffSchaller noted that a terminated nano process saves the unwritten file in file_path.extension.save.



        If it is there, which it was for me, it is a simple matter of mving the file into its original name.







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered May 3 at 21:39









        OldBunny2800

        1415




        1415






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441660%2fhow-to-exit-nano-from-a-different-terminal%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)