Saving file in nano to specific folder

Clash 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!
text-editor text nano
add a comment |Â
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!
text-editor text nano
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
add a comment |Â
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!
text-editor text nano
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!
text-editor text nano
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
3
I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
â steeldriver
May 4 at 14:58
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
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
answered May 9 at 16:05
chaptuck
534517
534517
add a comment |Â
add a comment |Â
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
3
I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
â steeldriver
May 4 at 14:58
add a comment |Â
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
3
I think the OP is asking about setting the path interactively at the Ctrl-O save prompt
â steeldriver
May 4 at 14:58
add a comment |Â
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
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
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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