Yes you could save it temporarily to your home directory. Press Ctrl+O to change the path to your home directory or in /tmp and then press Enter to save it. Then you can sudo mv
it.
Press CTRL+O will show you the path. Change that to your home directory or /tmp. For example File Name to Write: /tmp/filename and press Enter.
According to the man page for GNU nano 2.9.3, you can use the -l
or --linenumbers
flags.
-l, --linenumbers
Display line numbers to the left of the text area.
Alternatively, according to the man page for nanorc, you can add set linenumbers
in ~/.nanorc
, $XDG_CONFIG_HOME/nano/nanorc
or ~/.config/nano/nanorc
.
INITIALIZATION FILE
nano will read two configuration files: first the system's nanorc (if
it exists), and then the user's nanorc (if it exists), either ~/.nanorc
or $XDG_CONFIG_HOME/nano/nanorc or ~/.config/nano/nanorc, whichever is
encountered first. See nanorc(5) for more information on the possible
contents of those files.
set linenumbers
Display line numbers to the left of the text area.
Edit
In response to comments about alternate config files, from the description of man nanorc
:
During startup, nano will first
read the system-wide settings, from /etc/nanorc (the exact path might be different on your
system), and then the user-specific settings, either from ~/.nanorc or from $XDG_CON‐
FIG_HOME/nano/nanorc or from ~/.config/nano/nanorc, whichever is encountered first.
I would not typically advise others to change the system-wide config file, unless you have a good reason to do so, as it will likely be overwritten during any updates, and is not likely to be included in system backups, which typically only include the home directory.
Best Answer
Ctrl + X will quit the editor and you will be asked if you want to save your changes. If you do, press Y for
Yes
.Ctrl + O should also work, since that means to save the file, but you won't be asked "Save modifier buffer ? " because you already told
nano
to save.