nano: Command-line Options

1 
1 3 Command-line Options
1 **********************
1 
1 ‘nano’ takes the following options from the command line:
1 
1 ‘-A’
1 ‘--smarthome’
1      Make the Home key smarter.  When Home is pressed anywhere but at
1      the very beginning of non-whitespace characters on a line, the
1      cursor will jump to that beginning (either forwards or backwards).
1      If the cursor is already at that position, it will jump to the true
1      beginning of the line.
1 
1 ‘-B’
1 ‘--backup’
1      When saving a file, back up the previous version of it, using the
1      current filename suffixed with a tilde (‘~’).
1 
1 ‘-C DIRECTORY’
1 ‘--backupdir=DIRECTORY’
1      Make and keep not just one backup file, but make and keep a
1      uniquely numbered one every time a file is saved — when backups are
1      enabled.  The uniquely numbered files are stored in the specified
1      directory.
1 
1 ‘-D’
1 ‘--boldtext’
1      Use bold text instead of reverse video text.
1 
1 ‘-E’
1 ‘--tabstospaces’
1      Convert typed tabs to spaces.
1 
1 ‘-F’
1 ‘--multibuffer’
1      Read a file into a new buffer by default.
1 
1 ‘-G’
1 ‘--locking’
1      Enable vim-style file locking when editing files.
1 
1 ‘-H’
1 ‘--historylog’
1      Save the last hundred search strings and replacement strings and
1      executed commands, so they can be easily reused in later sessions.
1 
1 ‘-I’
1 ‘--ignorercfiles’
1      Don’t look at the system’s nanorc file nor at the user’s nanorc.
1 
1 ‘-K’
1 ‘--rebindkeypad’
1      Interpret the numeric keypad keys so that they all work properly.
1      You should only need to use this option if they don’t, as mouse
1      support won’t work properly with this option enabled.
1 
1 ‘-L’
1 ‘--nonewlines’
1      Don’t automatically add a newline when a file does not end with
1      one.
1 
1 ‘-M’
1 ‘--trimblanks’
1      Snip trailing whitespace from the wrapped line when automatic
1      hard-wrapping occurs or when text is justified.
1 
1 ‘-N’
1 ‘--noconvert’
1      Disable automatic conversion of files from DOS/Mac format.
1 
1 ‘-O’
1 ‘--morespace’
1      Use the blank line below the title bar as extra editing space.
1 
1 ‘-P’
1 ‘--positionlog’
1      For the 200 most recent files, log the last position of the cursor,
1      and place it at that position again upon reopening such a file.
1 
1 ‘-Q "REGEX"’
1 ‘--quotestr="REGEX"’
1      Set the regular expression for matching the quoting part of a line,
1      used when justifying.  The default value is
1      "^([ \t]*([#:>|}]|//))+".  Note that ‘\t’ stands for a literal Tab
1      character.
1 
1 ‘-R’
1 ‘--restricted’
1      Restricted mode: don’t read or write to any file not specified on
1      the command line; don’t read any nanorc files nor history files;
1      don’t allow suspending nor spell checking; don’t allow a file to be
1      appended to, prepended to, or saved under a different name if it
1      already has one; and don’t use backup files.  This restricted mode
1      is also accessible by invoking ‘nano’ with any name beginning with
1      ‘r’ (e.g. ‘rnano’).
1 
1 ‘-S’
1 ‘--smooth’
1      Enable smooth scrolling.  Text will scroll line-by-line, instead of
1      the usual chunk-by-chunk behavior.
1 
1 ‘-T NUMBER’
1 ‘--tabsize=NUMBER’
1      Set the displayed tab length to NUMBER columns.  The value of
1      NUMBER must be greater than 0.  The default value is 8.
1 
1 ‘-U’
1 ‘--quickblank’
1      Do quick status-bar blanking: status-bar messages will disappear
1      after 1 keystroke instead of 25.  Note that option ‘-c’
1      (‘--constantshow’) overrides this.
1 
1 ‘-V’
1 ‘--version’
1      Show the current version number and exit.
1 
1 ‘-W’
1 ‘--wordbounds’
1      Detect word boundaries differently by treating punctuation
1      characters as parts of words.
1 
1 ‘-X "CHARACTERS"’
1 ‘--wordchars="CHARACTERS"’
1      Specify which other characters (besides the normal alphanumeric
1      ones) should be considered as parts of words.  This overrides
1      option ‘-W’ (‘--wordbounds’).
1 
1 ‘-Y NAME’
1 ‘--syntax=NAME’
11      Specify the syntax to be used for highlighting.  ⇒Syntax
      Highlighting for more info.
1 
1 ‘-a’
1 ‘--atblanks’
1      When doing soft line wrapping, wrap lines at whitespace instead of
1      always at the edge of the screen.
1 
1 ‘-c’
1 ‘--constantshow’
1      Constantly display the cursor position (line number, column number,
1      and character number) on the status bar.  Note that this overrides
1      option ‘-U’ (‘--quickblank’).
1 
1 ‘-d’
1 ‘--rebinddelete’
1      Interpret the Delete key differently so that both Backspace and
1      Delete work properly.  You should only need to use this option if
1      Backspace acts like Delete on your system.
1 
1 ‘-g’
1 ‘--showcursor’
1      Make the cursor visible in the file browser, putting it on the
1      highlighted item.  Useful for braille users.
1 
1 ‘-h’
1 ‘--help’
1      Show a summary of command-line options and exit.
1 
1 ‘-i’
1 ‘--autoindent’
1      Automatically indent a newly created line to the same number of
1      tabs and/or spaces as the previous line (or as the next line if the
1      previous line is the beginning of a paragraph).
1 
1 ‘-k’
1 ‘--cutfromcursor’
1      Make the ’Cut Text’ command (normally ‘^K’) cut from the current
1      cursor position to the end of the line, instead of cutting the
1      entire line.
1 
1 ‘-l’
1 ‘--linenumbers’
1      Display line numbers to the left of the text area.
1 
1 ‘-m’
1 ‘--mouse’
1      Enable mouse support, if available for your system.  When enabled,
1      mouse clicks can be used to place the cursor, set the mark (with a
1      double click), and execute shortcuts.  The mouse will work in the X
1      Window System, and on the console when gpm is running.  Text can
1      still be selected through dragging by holding down the Shift key.
1 
1 ‘-n’
1 ‘--noread’
1      Treat any name given on the command line as a new file.  This
1      allows ‘nano’ to write to named pipes: it will start with a blank
1      buffer, and will write to the pipe when the user saves the "file".
1      This way ‘nano’ can be used as an editor in combination with for
1      instance ‘gpg’ without having to write sensitive data to disk
1      first.
1 
1 ‘-o DIRECTORY’
1 ‘--operatingdir=DIRECTORY’
1      Set the operating directory.  This makes ‘nano’ set up something
1      similar to a chroot.
1 
1 ‘-p’
1 ‘--preserve’
1      Preserve the ‘^Q’ (XON) and ‘^S’ (XOFF) sequences so data being
1      sent to the editor can be stopped and started.
1 
1 ‘-q’
1 ‘--quiet’
1      Obsolete option.  Recognized but ignored.
1 
1 ‘-r NUMBER’
1 ‘--fill=NUMBER’
1      Hard-wrap lines at column NUMBER (by inserting a newline
1      character).  If the given value is 0 or less, wrapping will occur
1      at the width of the screen minus the given amount, allowing the
1      wrapping width to vary along with the width of the screen if and
1      when it is resized.  The default value is -8.  This option
1      conflicts with ‘-w’ (‘--nowrap’); the last one given takes effect.
1 
1 ‘-s PROGRAM’
1 ‘--speller=PROGRAM’
1      Use the given program to do spell checking and correcting.  By
1      default, ‘nano’ uses the command specified in the ‘SPELL’
1      environment variable.  If ‘SPELL’ is not set, and ‘--speller’ is
1      not specified either, then ‘nano’ uses its own interactive spell
1      corrector, which requires the GNU ‘spell’ program to be installed.
1 
1 ‘-t’
1 ‘--tempfile’
1      Don’t ask whether to save a modified buffer when exiting with ‘^X’,
1      but assume yes.  This option is useful when ‘nano’ is used as the
1      composer of a mailer program.
1 
1 ‘-u’
1 ‘--unix’
1      Save a file by default in Unix format.  This overrides nano’s
1      default behavior of saving a file in the format that it had.  (This
1      option has no effect when you also use ‘--noconvert’.)
1 
1 ‘-v’
1 ‘--view’
1      Don’t allow the contents of the file to be altered.  Note that this
1      option should NOT be used in place of correct file permissions to
1      implement a read-only file.
1 
1 ‘-w’
1 ‘--nowrap’
1      Don’t hard-wrap long lines at any length.  This option conflicts
1      with ‘-r’ (‘--fill’); the last one given takes effect.
1 
1 ‘-x’
1 ‘--nohelp’
1      Expert Mode: don’t show the Shortcut List at the bottom of the
1      screen.  This affects the location of the status bar as well, as in
1      Expert Mode it is located at the very bottom of the editor.
1 
1      Note: When accessing the help system, Expert Mode is temporarily
1      disabled to display the help-system navigation keys.
1 
1 ‘-y’
1 ‘--afterends’
1      Make Ctrl+Right stop at word ends instead of beginnings.
1 
1 ‘-z’
1 ‘--suspend’
1      Enable the ability to suspend ‘nano’ using the system’s suspend
1      keystroke (usually ‘^Z’).
1 
1 ‘-$’
1 ‘--softwrap’
1      Enable ’soft wrapping’.  This will make ‘nano’ attempt to display
1      the entire contents of any line, even if it is longer than the
1      screen width, by continuing it over multiple screen lines.  Since
1      ‘$’ normally refers to a variable in the Unix shell, you should
1      specify this option last when using other options (e.g. ‘nano
1      -wS$’) or pass it separately (e.g. ‘nano -wS -$’).
1 
1 ‘-b’
1 ‘-e’
1 ‘-f’
1 ‘-j’
1      Ignored, for compatibility with Pico.
1