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

NAME

6       nano - Nano's ANOther editor, inspired by Pico
7
8

SYNOPSIS

10       nano [options] [[+line[,column]] file]...
11
12       nano [options] [[+[crCR](/|?)string] file]...
13
14

NOTICE

16       Since version 4.0, nano by default:
17
18           · does not automatically hard-wrap lines that become overlong,
19           · includes the line below the title bar in the editing area,
20           · does linewise (smooth) scrolling.
21
22       If  you want the old, Pico behavior back, you can use --breaklonglines,
23       --emptyline, and --jumpyscrolling (or -bej for short).
24
25

DESCRIPTION

27       nano is a small and friendly editor.  It copies the look  and  feel  of
28       Pico,  but  is free software, and implements several features that Pico
29       lacks, such as: opening multiple files, scrolling per line,  undo/redo,
30       syntax coloring, line numbering, and soft-wrapping overlong lines.
31
32       When  giving a filename on the command line, the cursor can be put on a
33       specific line by adding the line number with a plus sign (+) before the
34       filename,  and  even  in  a  specific column by adding it with a comma.
35       (Negative numbers count from the end of the file or line.)  The  cursor
36       can  be  put  on  the  first or last occurrence of a specific string by
37       specifying that string after +/ or +? before the filename.  The  string
38       can be made case sensitive and/or caused to be interpreted as a regular
39       expression by inserting c and/or r after  the  +  sign.   These  search
40       modes  can  be  explicitly  disabled  by using the uppercase variant of
41       those letters: C and/or R.  When the string contains spaces,  it  needs
42       to  be  enclosed  in quotes.  To give an example: to open a file at the
43       first occurrence of the word "Foo", one would do:
44
45           nano +c/Foo file
46
47       As a special case: if instead of a filename a dash (-) is  given,  nano
48       will read data from standard input.
49
50

EDITING

52       Entering  text  and  moving around in a file is straightforward: typing
53       the letters and using the normal cursor movement  keys.   Commands  are
54       entered by using the Control (^) and the Alt or Meta (M-) keys.  Typing
55       ^K deletes the current line and puts it in the cutbuffer.   Consecutive
56       ^Ks  will  put all deleted lines together in the cutbuffer.  Any cursor
57       movement or executing any other command will cause the next ^K to over‐
58       write  the cutbuffer.  A ^U will paste the current contents of the cut‐
59       buffer at the current cursor position.
60
61       When a more precise piece of text needs to be cut or  copied,  one  can
62       mark  its  start  with  ^6, move the cursor to its end (the marked text
63       will be highlighted), and then use ^K to cut it, or M-6 to copy  it  to
64       the cutbuffer.  One can also save the marked text to a file with ^O, or
65       spell check it with ^T.
66
67       On some terminals, text can be selected  also  by  holding  down  Shift
68       while  using the arrow keys.  Holding down the Ctrl or Alt key too will
69       increase the stride.  Any cursor movement without Shift being held will
70       cancel such a selection.
71
72       The two lines at the bottom of the screen show some important commands;
73       the built-in help (^G) lists all the available ones.  The  default  key
74       bindings can be changed via a nanorc file -- see nanorc(5).
75
76

OPTIONS

78       -A, --smarthome
79              Make the Home key smarter.  When Home is pressed anywhere but at
80              the very beginning of non-whitespace characters on a  line,  the
81              cursor  will  jump  to  that beginning (either forwards or back‐
82              wards).  If the cursor is already at that position, it will jump
83              to the true beginning of the line.
84
85       -B, --backup
86              When  saving  a  file, back up the previous version of it, using
87              the current filename suffixed with a tilde (~).
88
89       -C directory, --backupdir=directory
90              Make and keep not just one backup file,  but  make  and  keep  a
91              uniquely numbered one every time a file is saved -- when backups
92              are enabled (-B).  The uniquely numbered files are stored in the
93              specified directory.
94
95       -D, --boldtext
96              For the interface, use bold instead of reverse video.  This will
97              be overridden by setting the  options  titlecolor,  statuscolor,
98              keycolor,  functioncolor,  numbercolor,  and/or selectedcolor in
99              your nanorc file.  See nanorc(5).
100
101       -E, --tabstospaces
102              Convert typed tabs to spaces.
103
104       -F, --multibuffer
105              Read a file into a new buffer by default.
106
107       -G, --locking
108              Use vim-style file locking when editing files.
109
110       -H, --historylog
111              Save the last hundred search strings and replacement strings and
112              executed  commands,  so  they can be easily reused in later ses‐
113              sions.
114
115       -I, --ignorercfiles
116              Don't look at the system's nanorc nor at the user's nanorc.
117
118       -J number, --guidestripe=number
119              Draw a vertical stripe at the given column, to  help  judge  the
120              width of the text.  (The color of the stripe can be changed with
121              set stripecolor in your nanorc file.)
122
123       -K, --rawsequences
124              Interpret escape sequences directly (instead of  asking  ncurses
125              to  translate  them).   If you need this option to get your key‐
126              board to work properly, please report a bug.  Using this  option
127              disables nano's mouse support.
128
129       -L, --nonewlines
130              Don't  automatically add a newline when a text does not end with
131              one.  (This can cause you to save non-POSIX text files.)
132
133       -M, --trimblanks
134              Snip trailing whitespace from the wrapped  line  when  automatic
135              hard-wrapping occurs or when text is justified.
136
137       -N, --noconvert
138              Disable automatic conversion of files from DOS/Mac format.
139
140       -O, --morespace
141              Obsolete  and ignored option, since the line below the title bar
142              is included into the editing space by default.  If you prefer to
143              keep this line blank, use -e or --emptyline.
144
145       -P, --positionlog
146              For the 200 most recent files, log the last position of the cur‐
147              sor, and place it at that position again upon reopening  such  a
148              file.
149
150       -Q "regex", --quotestr="regex"
151              Set  the  regular  expression for matching the quoting part of a
152              line.  The default value is "^([ \t]*([!#%:;>|}]|//))+".   (Note
153              that  \t  stands  for an actual Tab.)  This makes it possible to
154              rejustify blocks of quoted text when composing email, and to re‐
155              wrap blocks of line comments when writing source code.
156
157       -R, --restricted
158              Restricted  mode:  don't read or write to any file not specified
159              on the command line.  This means: don't read  or  write  history
160              files; don't allow suspending; don't allow spell checking; don't
161              allow a file to be appended to, prepended to, or saved  under  a
162              different  name  if  it  already  has one; and don't make backup
163              files.  Restricted mode can also be activated by  invoking  nano
164              with any name beginning with 'r' (e.g. "rnano").
165
166       -S, --smooth
167              Obsolete  and  ignored option, since smooth scrolling has become
168              the default.  If you prefer the chunk-by-chunk scrolling  behav‐
169              ior, use -j or --jumpyscrolling.
170
171       -T number, --tabsize=number
172              Set  the  size (width) of a tab to number columns.  The value of
173              number must be greater than 0.  The default value is 8.
174
175       -U, --quickblank
176              Do quick status-bar blanking: status-bar messages will disappear
177              after  1  keystroke  instead of 25.  Note that option -c (--con‐
178              stantshow) overrides this.
179
180       -V, --version
181              Show the current version number and exit.
182
183       -W, --wordbounds
184              Detect word boundaries differently by treating punctuation char‐
185              acters as part of a word.
186
187       -X "characters", --wordchars="characters"
188              Specify  which other characters (besides the normal alphanumeric
189              ones) should be considered as part of a  word.   This  overrides
190              option -W (--wordbounds).
191
192       -Y name, --syntax=name
193              Specify  the  name  of the syntax highlighting to use from among
194              the ones defined in the nanorc files.
195
196       -Z, --zap
197              Let an unmodified Backspace or Delete erase  the  marked  region
198              (instead  of  a single character, and without affecting the cut‐
199              buffer).
200
201       -a, --atblanks
202              When doing soft line wrapping, wrap lines at whitespace  instead
203              of always at the edge of the screen.
204
205       -b, --breaklonglines
206              Automatically  hard-wrap  the current line when it becomes over‐
207              long.  (This option is the opposite of -w (--nowrap) -- the last
208              one given takes effect.)
209
210       -c, --constantshow
211              Constantly  show  the  cursor  position on the status bar.  Note
212              that this overrides option -U (--quickblank).
213
214       -d, --rebinddelete
215              Interpret the Delete and Backspace keys differently so that both
216              Backspace  and  Delete  work properly.  You should only use this
217              option when on your system either Backspace acts like Delete  or
218              Delete acts like Backspace.
219
220       -e, --emptyline
221              Do  not  use  the  line below the title bar, leaving it entirely
222              blank.
223
224       -f file, --rcfile=file
225              Read only this file for setting nano's options, instead of read‐
226              ing both the system-wide and the user's nanorc files.
227
228       -g, --showcursor
229              Make  the  cursor visible in the file browser (putting it on the
230              highlighted item) and in the help viewer.   Useful  for  braille
231              users and people with poor vision.
232
233       -h, --help
234              Show a summary of the available command-line options and exit.
235
236       -i, --autoindent
237              Automatically  indent a newly created line to the same number of
238              tabs and/or spaces as the previous line (or as the next line  if
239              the previous line is the beginning of a paragraph).
240
241       -j, --jumpyscrolling
242              Scroll the buffer contents per half-screen instead of per line.
243
244       -k, --cutfromcursor
245              Make  the  'Cut Text' command (normally ^K) cut from the current
246              cursor position to the end of the line, instead of  cutting  the
247              entire line.
248
249       -l, --linenumbers
250              Display line numbers to the left of the text area.
251
252       -m, --mouse
253              Enable  mouse  support,  if  available  for  your  system.  When
254              enabled, mouse clicks can be used to place the cursor,  set  the
255              mark  (with  a  double click), and execute shortcuts.  The mouse
256              will work in the X Window System, and on the console when gpm is
257              running.  Text can still be selected through dragging by holding
258              down the Shift key.
259
260       -n, --noread
261              Treat any name given on the command line as a  new  file.   This
262              allows  nano to write to named pipes: it will start with a blank
263              buffer, and will write to the  pipe  when  the  user  saves  the
264              "file".   This  way nano can be used as an editor in combination
265              with for instance gpg without having to write sensitive data  to
266              disk first.
267
268       -o directory, --operatingdir=directory
269              Set  the  operating directory.  This makes nano set up something
270              similar to a chroot.
271
272       -p, --preserve
273              Preserve the XON and XOFF sequences (^Q and ^S) so they will  be
274              caught by the terminal.
275
276       -r number, --fill=number
277              Set  the target width for justifying and automatic hard-wrapping
278              at this number of columns.  If the value is 0 or less,  wrapping
279              will  occur  at  the  width  of the screen minus number columns,
280              allowing the wrap point to vary along  with  the  width  of  the
281              screen if the screen is resized.  The default value is -8.
282
283       -s "program [argument ...]", --speller="program [argument ...]"
284              Use  this  command  to  perform  spell  checking and correcting,
285              instead of using the built-in corrector that calls  hunspell  or
286              GNU spell.
287
288       -t, --tempfile
289              Save a changed buffer without prompting (when exiting with ^X).
290
291       -u, --unix
292              Save  a  file  by default in Unix format.  This overrides nano's
293              default behavior of saving a file in the  format  that  it  had.
294              (This option has no effect when you also use --noconvert.)
295
296       -v, --view
297              Just  view  the file and disallow editing: read-only mode.  This
298              mode allows the user to  open  also  other  files  for  viewing,
299              unless --restricted is given too.
300
301       -w, --nowrap
302              Do  not automatically hard-wrap the current line when it becomes
303              overlong.  This is the default.  (This option is the opposite of
304              -b (--breaklonglines) -- the last one given takes effect.)
305
306
307       -x, --nohelp
308              Don't show the two help lines at the bottom of the screen.
309
310       -y, --afterends
311              Make Ctrl+Right stop at word ends instead of beginnings.
312
313       -z, --suspendable
314              Allow the user to suspend the editor (with ^Z by default).
315
316       -$, --softwrap
317              Display  lines  that  exceed  the  screen's  width over multiple
318              screen lines.  (You can make this soft-wrapping occur at  white‐
319              space  instead  of  rudely  at  the screen's edge, by using also
320              --atblanks.)  Since '$' normally refers to  a  variable  in  the
321              Unix shell, you should specify this option last when using other
322              options (e.g. 'nano -wS$') or pass it separately (e.g. 'nano -wS
323              -$').
324
325

TOGGLES

327       Several of the above options can be switched on and off also while nano
328       is running.  For example, M-L toggles the hard-wrapping of long  lines,
329       M-S  toggles  soft-wrapping,  M-N toggles line numbers, M-M toggles the
330       mouse, M-I auto-indentation, and M-X the help lines.  See at the end of
331       the ^G help text for a complete list.
332
333

FILES

335       When --rcfile is given, nano will read just the specified file for set‐
336       ting its options and syntaxes and key bindings.  Without  that  option,
337       nano  will  read two configuration files: first the system's nanorc (if
338       it exists), and then the user's nanorc (if it exists), either ~/.nanorc
339       or  $XDG_CONFIG_HOME/nano/nanorc or ~/.config/nano/nanorc, whichever is
340       encountered first.  See nanorc(5) for more information on the  possible
341       contents of those files.
342
343

NOTES

345       If  no  alternative  spell  checker command is specified on the command
346       line nor in one of the nanorc files, nano will check the SPELL environ‐
347       ment variable for one.
348
349       In  some cases nano will try to dump the buffer into an emergency file.
350       This will happen mainly if nano receives a SIGHUP or  SIGTERM  or  runs
351       out of memory.  It will write the buffer into a file named nano.save if
352       the buffer didn't have a name already, or will add a ".save" suffix  to
353       the  current  filename.   If  an  emergency file with that name already
354       exists in the current directory, it will  add  ".save"  plus  a  number
355       (e.g.  ".save.1")  to  the current filename in order to make it unique.
356       In multibuffer mode, nano will write all  the  open  buffers  to  their
357       respective emergency files.
358
359

BUGS

361       The recording and playback of keyboard macros works correctly only on a
362       terminal emulator, not on a Linux console (VT), because the latter does
363       not by default distinguish modified from unmodified arrow keys.
364
365       Please report any other bugs that you encounter via:
366       https://savannah.gnu.org/bugs/?group=nano.
367
368       When nano crashes, it will save any modified buffers to emergency .save
369       files.  If you are able to reproduce the crash and you want  to  get  a
370       backtrace, define the environment variable NANO_NOCATCH.
371
372

HOMEPAGE

374       https://nano-editor.org/
375
376

SEE ALSO

378       nanorc(5)
379
380       /usr/share/doc/nano/ (or equivalent on your system)
381
382
383
384April 2020                       version 4.9.2                         NANO(1)
Impressum