Saving file in nano to specific folder

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








up vote
3
down vote

favorite












I'm trying to save a file in the nano text editor. I wrote a short test text and entered ctrl+O to save and name the file but I'm not sure how I can save file to a specific folder? and how I can later find the file I created.
thanks!







share|improve this question




















  • Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
    – Emily
    May 4 at 16:51










  • If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
    – Emily
    May 4 at 16:54










  • Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
    – Emily
    May 4 at 16:55















up vote
3
down vote

favorite












I'm trying to save a file in the nano text editor. I wrote a short test text and entered ctrl+O to save and name the file but I'm not sure how I can save file to a specific folder? and how I can later find the file I created.
thanks!







share|improve this question




















  • Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
    – Emily
    May 4 at 16:51










  • If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
    – Emily
    May 4 at 16:54










  • Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
    – Emily
    May 4 at 16:55













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I'm trying to save a file in the nano text editor. I wrote a short test text and entered ctrl+O to save and name the file but I'm not sure how I can save file to a specific folder? and how I can later find the file I created.
thanks!







share|improve this question












I'm trying to save a file in the nano text editor. I wrote a short test text and entered ctrl+O to save and name the file but I'm not sure how I can save file to a specific folder? and how I can later find the file I created.
thanks!









share|improve this question











share|improve this question




share|improve this question










asked May 4 at 14:00









kitty

161




161











  • Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
    – Emily
    May 4 at 16:51










  • If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
    – Emily
    May 4 at 16:54










  • Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
    – Emily
    May 4 at 16:55

















  • Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
    – Emily
    May 4 at 16:51










  • If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
    – Emily
    May 4 at 16:54










  • Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
    – Emily
    May 4 at 16:55
















Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
– Emily
May 4 at 16:51




Hi kitty. What is the file you're trying to save? Most people only use nano when they need to make small edits to some already existing file (for example a configuration file or other system file), simply because there are lots of limitations to what nano can do. By default, nano saves the file you're editing into the directory where the file lives.
– Emily
May 4 at 16:51












If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
– Emily
May 4 at 16:54




If you used nano to create a new file, it will be saved into whatever your current working directory was when you opened nano (this is displayed to the right of the semicolon after your username in Terminal/other CLI). You can cd into the directory where you want to save before running nano. Or, unless you have some specific reason you want to use nano, just use a GUI text editor instead. All versions and flavors of Ubuntu come with a standard text editor with a GUI component, e.g. for Ubuntu 16.04 it's gedit; for Lubuntu it's Leafpad.
– Emily
May 4 at 16:54












Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
– Emily
May 4 at 16:55





Alternatively, you could use vim, another console text editor--you don't need to cd into your desired directory to save there before running vi; you can specify where you want the file to go upon saving--see this question
– Emily
May 4 at 16:55











2 Answers
2






active

oldest

votes

















up vote
2
down vote













Nano by default saves to the current working directory (CWD) or to the relative path from your CWD to the file that is open. If you want to save to another directory you just prepend the filename with the path



For example



Ctrl+O opens the save prompt



File Name to Write: ~/test.txt


Will save test.txt to my home directory



File Name to Write: ../test.txt


Will save test.txt to one directory above my CWD



File Name to Write: /absolute/path/to/file/text.txt


Will save text.txt in /absolute/path/to/file/ directory



After you save a file nano will be using that path in the buffer. To see that path Ctrl+O opens the save prompt with the new relative path Ctrl+C to cancel saving



While in the save prompt Ctrl+T opens a handy file browser you can use






share|improve this answer



























    up vote
    1
    down vote













    If the specific folder already exists, there are several ways to do this. First, let’s assume that the folder is in your own user directory. We’ll tell nano that’s where we want to create the test file. From the terminal:



    nano /home/<your_user_name>/<some_folder>/test.txt


    Or, the more convenient:



    nano ~/<some_folder>/test.txt


    You can also first navigate to the location you want the file to reside:



    cd ~/<some_folder>
    nano test.txt


    If the folder doesn’t yet exist, create it:



    mkdir ~/<some_folder>
    cd ~/<some_folder>
    nano test.txt





    share|improve this answer
















    • 3




      I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
      – steeldriver
      May 4 at 14:58










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    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: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2faskubuntu.com%2fquestions%2f1031999%2fsaving-file-in-nano-to-specific-folder%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
    2
    down vote













    Nano by default saves to the current working directory (CWD) or to the relative path from your CWD to the file that is open. If you want to save to another directory you just prepend the filename with the path



    For example



    Ctrl+O opens the save prompt



    File Name to Write: ~/test.txt


    Will save test.txt to my home directory



    File Name to Write: ../test.txt


    Will save test.txt to one directory above my CWD



    File Name to Write: /absolute/path/to/file/text.txt


    Will save text.txt in /absolute/path/to/file/ directory



    After you save a file nano will be using that path in the buffer. To see that path Ctrl+O opens the save prompt with the new relative path Ctrl+C to cancel saving



    While in the save prompt Ctrl+T opens a handy file browser you can use






    share|improve this answer
























      up vote
      2
      down vote













      Nano by default saves to the current working directory (CWD) or to the relative path from your CWD to the file that is open. If you want to save to another directory you just prepend the filename with the path



      For example



      Ctrl+O opens the save prompt



      File Name to Write: ~/test.txt


      Will save test.txt to my home directory



      File Name to Write: ../test.txt


      Will save test.txt to one directory above my CWD



      File Name to Write: /absolute/path/to/file/text.txt


      Will save text.txt in /absolute/path/to/file/ directory



      After you save a file nano will be using that path in the buffer. To see that path Ctrl+O opens the save prompt with the new relative path Ctrl+C to cancel saving



      While in the save prompt Ctrl+T opens a handy file browser you can use






      share|improve this answer






















        up vote
        2
        down vote










        up vote
        2
        down vote









        Nano by default saves to the current working directory (CWD) or to the relative path from your CWD to the file that is open. If you want to save to another directory you just prepend the filename with the path



        For example



        Ctrl+O opens the save prompt



        File Name to Write: ~/test.txt


        Will save test.txt to my home directory



        File Name to Write: ../test.txt


        Will save test.txt to one directory above my CWD



        File Name to Write: /absolute/path/to/file/text.txt


        Will save text.txt in /absolute/path/to/file/ directory



        After you save a file nano will be using that path in the buffer. To see that path Ctrl+O opens the save prompt with the new relative path Ctrl+C to cancel saving



        While in the save prompt Ctrl+T opens a handy file browser you can use






        share|improve this answer












        Nano by default saves to the current working directory (CWD) or to the relative path from your CWD to the file that is open. If you want to save to another directory you just prepend the filename with the path



        For example



        Ctrl+O opens the save prompt



        File Name to Write: ~/test.txt


        Will save test.txt to my home directory



        File Name to Write: ../test.txt


        Will save test.txt to one directory above my CWD



        File Name to Write: /absolute/path/to/file/text.txt


        Will save text.txt in /absolute/path/to/file/ directory



        After you save a file nano will be using that path in the buffer. To see that path Ctrl+O opens the save prompt with the new relative path Ctrl+C to cancel saving



        While in the save prompt Ctrl+T opens a handy file browser you can use







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 9 at 16:05









        chaptuck

        534517




        534517






















            up vote
            1
            down vote













            If the specific folder already exists, there are several ways to do this. First, let’s assume that the folder is in your own user directory. We’ll tell nano that’s where we want to create the test file. From the terminal:



            nano /home/<your_user_name>/<some_folder>/test.txt


            Or, the more convenient:



            nano ~/<some_folder>/test.txt


            You can also first navigate to the location you want the file to reside:



            cd ~/<some_folder>
            nano test.txt


            If the folder doesn’t yet exist, create it:



            mkdir ~/<some_folder>
            cd ~/<some_folder>
            nano test.txt





            share|improve this answer
















            • 3




              I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
              – steeldriver
              May 4 at 14:58














            up vote
            1
            down vote













            If the specific folder already exists, there are several ways to do this. First, let’s assume that the folder is in your own user directory. We’ll tell nano that’s where we want to create the test file. From the terminal:



            nano /home/<your_user_name>/<some_folder>/test.txt


            Or, the more convenient:



            nano ~/<some_folder>/test.txt


            You can also first navigate to the location you want the file to reside:



            cd ~/<some_folder>
            nano test.txt


            If the folder doesn’t yet exist, create it:



            mkdir ~/<some_folder>
            cd ~/<some_folder>
            nano test.txt





            share|improve this answer
















            • 3




              I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
              – steeldriver
              May 4 at 14:58












            up vote
            1
            down vote










            up vote
            1
            down vote









            If the specific folder already exists, there are several ways to do this. First, let’s assume that the folder is in your own user directory. We’ll tell nano that’s where we want to create the test file. From the terminal:



            nano /home/<your_user_name>/<some_folder>/test.txt


            Or, the more convenient:



            nano ~/<some_folder>/test.txt


            You can also first navigate to the location you want the file to reside:



            cd ~/<some_folder>
            nano test.txt


            If the folder doesn’t yet exist, create it:



            mkdir ~/<some_folder>
            cd ~/<some_folder>
            nano test.txt





            share|improve this answer












            If the specific folder already exists, there are several ways to do this. First, let’s assume that the folder is in your own user directory. We’ll tell nano that’s where we want to create the test file. From the terminal:



            nano /home/<your_user_name>/<some_folder>/test.txt


            Or, the more convenient:



            nano ~/<some_folder>/test.txt


            You can also first navigate to the location you want the file to reside:



            cd ~/<some_folder>
            nano test.txt


            If the folder doesn’t yet exist, create it:



            mkdir ~/<some_folder>
            cd ~/<some_folder>
            nano test.txt






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 4 at 14:41









            chili555

            36.4k54776




            36.4k54776







            • 3




              I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
              – steeldriver
              May 4 at 14:58












            • 3




              I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
              – steeldriver
              May 4 at 14:58







            3




            3




            I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
            – steeldriver
            May 4 at 14:58




            I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
            – steeldriver
            May 4 at 14:58












             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1031999%2fsaving-file-in-nano-to-specific-folder%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Trouble downloading packages list due to a “Hash sum mismatch” error

            How do I move numbers in filenames, in a batch renaming operation?