Nano is a free text editor for linux and unix-systems and compared to other editors (like vi, pico) is it easy to use. And nano is a very nice editor for those users that dislike vi
.
You handle nano with the arrow keys on your keyboard. Additionally key combinations are used to save or cut something.
Installation
No installation is needed. nano is part of the core package as of Core Update 167.
Usage
Note: From Core Update 187 onwards the search forward function control key is changed from ^W to ^F
There is no web interface for this Addon. To run this Addon open the client console or terminal and run the nano
command.
To obtain a list of possible commands, options, and arguments:
nano -h
The output is similar to this:
[root@ipfire ~]# nano -h
Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...
To place the cursor on a specific line of a file, put the line number with
a '+' before the filename. The column number can be added after a comma.
When a filename is '-', nano reads data from standard input.
Option Long option Meaning
-A --smarthome Enable smart home key
-B --backup Save backups of existing files
-C <dir> --backupdir=<dir> Directory for saving unique backup files
-D --boldtext Use bold instead of reverse video text
. . .
To edit a file (like /etc/passwd
) with Nano type the following command on your shell:
nano /etc/passwd
Want to change the fcrontab editor?
By default editing of fcrontab takes place with the editor vi
. To change the default editor to nano
edit the fcron.conf file:
nano /etc/fcron.conf
Look for editor = /usr/bin/vi
and change it to editor = /usr/bin/nano
.
[root@ipfire ~]# cat /etc/fcron.conf
# fcron.conf - Configuration file for fcron(8) and fcrontab(1).
# See fcron.conf(5) for syntax and explanations.
. . .
# Location of the default editor for "fcrontab -e"
#editor = /usr/bin/vi
editor = /usr/bin/nano
- Thanks to Bernhard for the hint!
Special Configuration
To modify nano behavior, create a hidden file named .nanorc
in the home directory of the user (/root
for the superuser):
touch .nanorc
there you can edit the file to enter specific directives, including syntax highlight. For example this line will activate bash syntax highlighting
include "/usr/share/nano/sh.nanorc"
to see all possibilities:
ls /usr/share/nano/
Include additional syntax highlighting
Edit the .nanorc
file and add:
include "/usr/share/nano/*.nanorc"
Note: remove other include ...
as duplicates may cause syntax highlight to fail.
To see all the possible variables that can be configured this way, go to nanorc manual page
Links
- You can find more information to Nano HERE