1NANO(1)                     General Commands Manual                    NANO(1)
2
3
4

NAME

6       nano - Nano's ANOther editor, an enhanced free Pico clone
7
8

SYNOPSIS

10       nano [options] [[+line[,column]] file]...
11
12

DESCRIPTION

14       nano  is  a  small and friendly editor.  It copies the look and feel of
15       Pico, but is free software, and implements several features  that  Pico
16       lacks,  such as: opening multiple files, scrolling per line, undo/redo,
17       syntax coloring, line numbering, and soft-wrapping overlong lines.
18
19       When giving a filename on the command line, the cursor can be put on  a
20       specific line by adding the line number with a plus sign (+) before the
21       filename, and even in a specific column by adding it with a comma.
22
23       As a special case: if instead of a filename a dash (-) is  given,  nano
24       will read data from standard input.
25
26

EDITING

28       Entering  text  and  moving around in a file is straightforward: typing
29       the letters and using the normal cursor movement  keys.   Commands  are
30       entered by using the Control (^) and the Alt or Meta (M-) keys.  Typing
31       ^K deletes the current line and puts it in the cutbuffer.   Consecutive
32       ^Ks  will  put all deleted lines together in the cutbuffer.  Any cursor
33       movement or executing any other command will cause the next ^K to over‐
34       write  the cutbuffer.  A ^U will paste the current contents of the cut‐
35       buffer at the current cursor position.
36
37       When a more precise piece of text needs to be cut or  copied,  one  can
38       mark  its  start  with  ^6, move the cursor to its end (the marked text
39       will be highlighted), and then use ^K to cut it, or M-6 to copy  it  to
40       the cutbuffer.  One can also save the marked text to a file with ^O, or
41       spell check it with ^T.
42
43       On some terminals, text can be selected  also  by  holding  down  Shift
44       while  using the arrow keys.  Holding down the Ctrl or Alt key too will
45       increase the stride.  Any cursor movement without Shift being held will
46       cancel such a selection.
47
48       The two lines at the bottom of the screen show some important commands;
49       the built-in help (^G) lists all the available ones.  The  default  key
50       bindings can be changed via a nanorc file -- see nanorc(5).
51
52

OPTIONS

54       -A, --smarthome
55              Make the Home key smarter.  When Home is pressed anywhere but at
56              the very beginning of non-whitespace characters on a  line,  the
57              cursor  will  jump  to  that beginning (either forwards or back‐
58              wards).  If the cursor is already at that position, it will jump
59              to the true beginning of the line.
60
61       -B, --backup
62              When  saving  a  file, back up the previous version of it, using
63              the current filename suffixed with a tilde (~).
64
65       -C directory, --backupdir=directory
66              Make and keep not just one backup file,  but  make  and  keep  a
67              uniquely numbered one every time a file is saved -- when backups
68              are enabled (-B).  The uniquely numbered files are stored in the
69              specified directory.
70
71       -D, --boldtext
72              Use bold text instead of reverse video text.
73
74       -E, --tabstospaces
75              Convert typed tabs to spaces.
76
77       -F, --multibuffer
78              Read a file into a new buffer by default.
79
80       -G, --locking
81              Use vim-style file locking when editing files.
82
83       -H, --historylog
84              Save the last hundred search strings and replacement strings and
85              executed commands, so they can be easily reused  in  later  ses‐
86              sions.
87
88       -I, --ignorercfiles
89              Don't look at the system's nanorc nor at the user's nanorc.
90
91       -K, --rebindkeypad
92              Interpret  the  numeric  keypad keys so that they all work prop‐
93              erly.  You should only need to use this option if they don't, as
94              mouse support won't work properly with this option enabled.
95
96       -L, --nonewlines
97              Don't  automatically add a newline when a file does not end with
98              one.
99
100       -M, --trimblanks
101              Snip trailing whitespace from the wrapped  line  when  automatic
102              hard-wrapping occurs or when text is justified.
103
104       -N, --noconvert
105              Disable automatic conversion of files from DOS/Mac format.
106
107       -O, --morespace
108              Use the blank line below the title bar as extra editing space.
109
110       -P, --positionlog
111              For the 200 most recent files, log the last position of the cur‐
112              sor, and place it at that position again upon reopening  such  a
113              file.
114
115       -Q "regex", --quotestr="regex"
116              Set  the  regular  expression for matching the quoting part of a
117              line.  This is used  when  justifying.   The  default  value  is
118              "^([ \t]*([#:>|}]|//))+".   Note  that  \t  stands for an actual
119              Tab.
120
121       -R, --restricted
122              Restricted mode: don't read or write to any file  not  specified
123              on  the  command  line;  don't read any nanorc files nor history
124              files; don't allow suspending nor spell checking; don't allow  a
125              file to be appended to, prepended to, or saved under a different
126              name if it already has one; and don't use  backup  files.   This
127              restricted  mode  is  also  accessible by invoking nano with any
128              name beginning with 'r' (e.g. "rnano").
129
130       -S, --smooth
131              Use smooth scrolling: text will scroll line-by-line, instead  of
132              the usual chunk-by-chunk behavior.
133
134       -T number, --tabsize=number
135              Set  the  size (width) of a tab to number columns.  The value of
136              number must be greater than 0.  The default value is 8.
137
138       -U, --quickblank
139              Do quick status-bar blanking: status-bar messages will disappear
140              after  1  keystroke  instead of 25.  Note that option -c (--con‐
141              stantshow) overrides this.
142
143       -V, --version
144              Show the current version number and exit.
145
146       -W, --wordbounds
147              Detect word boundaries differently by treating punctuation char‐
148              acters as part of a word.
149
150       -X "characters", --wordchars="characters"
151              Specify  which other characters (besides the normal alphanumeric
152              ones) should be considered as part of a  word.   This  overrides
153              option -W (--wordbounds).
154
155       -Y name, --syntax=name
156              Specify  the  name  of the syntax highlighting to use from among
157              the ones defined in the nanorc files.
158
159       -a, --atblanks
160              When doing soft line wrapping, wrap lines at whitespace  instead
161              of always at the edge of the screen.
162
163       -c, --constantshow
164              Constantly  show  the  cursor  position on the status bar.  Note
165              that this overrides option -U (--quickblank).
166
167       -d, --rebinddelete
168              Interpret the Delete key differently so that both Backspace  and
169              Delete  work  properly.  You should only need to use this option
170              if Backspace acts like Delete on your system.
171
172       -g, --showcursor
173              Make the cursor visible in the file browser, putting it  on  the
174              highlighted item.  Useful for braille users.
175
176       -h, --help
177              Show a summary of the available command-line options and exit.
178
179       -i, --autoindent
180              Automatically  indent a newly created line to the same number of
181              tabs and/or spaces as the previous line (or as the next line  if
182              the previous line is the beginning of a paragraph).
183
184       -k, --cutfromcursor
185              Make  the  'Cut Text' command (normally ^K) cut from the current
186              cursor position to the end of the line, instead of  cutting  the
187              entire line.
188
189       -l, --linenumbers
190              Display line numbers to the left of the text area.
191
192       -m, --mouse
193              Enable  mouse  support,  if  available  for  your  system.  When
194              enabled, mouse clicks can be used to place the cursor,  set  the
195              mark  (with  a  double click), and execute shortcuts.  The mouse
196              will work in the X Window System, and on the console when gpm is
197              running.  Text can still be selected through dragging by holding
198              down the Shift key.
199
200       -n, --noread
201              Treat any name given on the command line as a  new  file.   This
202              allows  nano to write to named pipes: it will start with a blank
203              buffer, and will write to the  pipe  when  the  user  saves  the
204              "file".   This  way nano can be used as an editor in combination
205              with for instance gpg without having to write sensitive data  to
206              disk first.
207
208       -o directory, --operatingdir=directory
209              Set  the  operating directory.  This makes nano set up something
210              similar to a chroot.
211
212       -p, --preserve
213              Preserve the XON and XOFF sequences (^Q and ^S) so they will  be
214              caught by the terminal.
215
216       -q, --quiet
217              Obsolete option.  Recognized but ignored.
218
219       -r number, --fill=number
220              Hard-wrap  lines  at column number.  If this value is 0 or less,
221              wrapping will occur at the width of the screen less number  col‐
222              umns,  allowing  the  wrap point to vary along with the width of
223              the screen if the screen is resized.  The default value  is  -8.
224              This  option  conflicts with -w (--nowrap) -- the last one given
225              takes effect.
226
227       -s program, --speller=program
228              Use this alternative spell checker command.
229
230       -t, --tempfile
231              Save a changed buffer without prompting (when exiting with ^X).
232
233       -u, --unix
234              Save a file by default in Unix format.   This  overrides  nano's
235              default  behavior  of  saving  a file in the format that it had.
236              (This option has no effect when you also use --noconvert.)
237
238       -v, --view
239              Just view the file and disallow editing: read-only mode.
240
241       -w, --nowrap
242              Disable the hard-wrapping of long lines.  This option  conflicts
243              with -r (--fill) -- the last one given takes effect.
244
245       -x, --nohelp
246              Don't show the two help lines at the bottom of the screen.
247
248       -y, --afterends
249              Make Ctrl+Right stop at word ends instead of beginnings.
250
251       -z, --suspend
252              Enable the suspend ability.
253
254       -$, --softwrap
255              Enable  'soft wrapping'.  This will make nano attempt to display
256              the entire contents of any line, even if it is longer  than  the
257              screen  width,  by  continuing  it  over  multiple screen lines.
258              Since '$' normally refers to a variable in the Unix  shell,  you
259              should  specify  this option last when using other options (e.g.
260              'nano -wS$') or pass it separately (e.g. 'nano -wS -$').
261
262       -b, -e, -f, -j
263              Ignored, for compatibility with Pico.
264
265

TOGGLES

267       Several of the above options can be switched on and off also while nano
268       is  running.  For example, M-L toggles the hard-wrapping of long lines,
269       M-$ toggles soft-wrapping, M-# toggles line numbers,  M-M  toggles  the
270       mouse, M-I auto-indentation, and M-X the help lines.  See at the end of
271       the ^G help text for a complete list.
272
273

INITIALIZATION FILE

275       nano will read two configuration files: first the system's  nanorc  (if
276       it exists), and then the user's nanorc (if it exists), either ~/.nanorc
277       or $XDG_CONFIG_HOME/nano/nanorc or ~/.config/nano/nanorc, whichever  is
278       encountered  first.  See nanorc(5) for more information on the possible
279       contents of those files.
280
281

NOTES

283       If no alternative spell checker command is  specified  on  the  command
284       line nor in one of the nanorc files, nano will check the SPELL environ‐
285       ment variable for one.
286
287       In some cases nano will try to dump the buffer into an emergency  file.
288       This  will  happen  mainly if nano receives a SIGHUP or SIGTERM or runs
289       out of memory.  It will write the buffer into a file named nano.save if
290       the  buffer didn't have a name already, or will add a ".save" suffix to
291       the current filename.  If an emergency  file  with  that  name  already
292       exists  in  the  current  directory,  it will add ".save" plus a number
293       (e.g. ".save.1") to the current filename in order to  make  it  unique.
294       In  multibuffer  mode,  nano  will  write all the open buffers to their
295       respective emergency files.
296
297

BUGS

299       Justifications (^J) are not yet covered by the general undo system.  So
300       after  a  justification  that  is not immediately undone, earlier edits
301       cannot be undone any more.  The workaround is, of course, to exit with‐
302       out saving.
303
304       The recording and playback of keyboard macros works correctly only on a
305       terminal emulator, not on a Linux console (VT), because the latter does
306       not by default distinguish modified from unmodified arrow keys.
307
308       Please report any other bugs that you encounter via:
309       https://savannah.gnu.org/bugs/?group=nano.
310
311       When nano crashes, it will save any modified buffers to emergency .save
312       files.  If you are able to reproduce the crash and you want  to  get  a
313       backtrace, define the environment variable NANO_NOCATCH.
314
315

HOMEPAGE

317       https://nano-editor.org/
318
319

SEE ALSO

321       nanorc(5)
322
323       /usr/share/doc/nano/ (or equivalent on your system)
324
325

AUTHOR

327       Chris  Allegretta  and  others  (see  the  files AUTHORS and THANKS for
328       details).  This manual page was originally written by Jordi Mallach for
329       the Debian system (but may be used by others).
330
331
332
333September 2018                    version 3.0                          NANO(1)
Impressum