Ctrl + G will let you read the help. nano
can do some pretty nice things so you might want to pootle around in there for a bit.
When you see ^G
(et al) it means Ctrl + G. In the help pages, M-H
means Alt + H.
How can I open text files for editing?
This is the default in nano
. Open and file and you're set to start editing:
nano filename
Note: you won't be able to save unless you have write permissions for that file.
How can I save the file?
F3 will let you save without exiting. Otherwise, Ctrl + X will prompt you if you've made changes. Press Y when it asks, and Enter to confirm the filename.
How can I quit the editor without saving the changes?
Ctrl + X, then N when it asks if you want to save.
How to edit? I heard that you've to enter some commands to begin editing in vi, is this true for nano too?
As above, no. nano
is simple. It drops you in edit mode as soon as it opens. You can use arrow keys, Page Up / Page Down and Home / End as in gedit. You cannot use the mouse for moving the cursor position.
Sometimes, if I manage to open a file, the text is unreadable due to its colors. How can I disable these colors?
Colours are loaded through the nanorc framework. These are files that are loaded when nano loads which basically spell out the syntax highlighting. To toggle syntax highlighting, press Alt + Y. To disable it permanently for certain file types, edit /etc/nanorc
and put a hash mark (#
) before include "/usr/share/nano/*.nanorc"
.
In the some files, lines are truncated because those do not fit in the screen. How can I prevent that from happening?
Well I've been trying to find something but the best I could see was enabling soft-line-wrap with the funky key-combination of: Alt + $ (Alt + Shift + 4).
To enable soft line wrapping by default, add the below line to ~/.nanorc
:
set softwrap
More information about this configuration file can be found at man nanorc
.
You can do it by
libreoffice --writer file.odt
If it is an odt
file, you can open it just by
libreoffice file.odt
Some file formats can be opened by different LO applications, then you need to specify which one to use.
Best Answer
libreoffice
comes with an option to convert anodt
file to plain text, which then can be edited with your preferred command-line text editor and (if wanted) converted back toodt
.Convert
document.odt
:Edit the file with your preferred text editor, e.g.:
Convert it back. The
--convert-to
takes a filename extension as an argument, but you may also specify a filename suffix to preventlibreoffice
from overwriting the original file (which it does without asking!):For the conversion there's also
odt2txt
, I'd just try both and compare the results.If you're using
vim
you can configure it to automatically do the conversion for you in the background, see: Is it possible to easily work with .odt, .doc, .docx, .rtf, and other non-plain-text formats in Vim? The answer there usesodt2txt
for the conversion, but it should be possible withlibreoffice --convert-to
as well.