Linux "pico" Command Line Options and Examples
Nano's ANOther editor, an enhanced free Pico clone

nano is a small and friendly editor. It copies the look and feel of Pico, but is free software, and imple‐ ments several features that Pico lacks, such as: opening multiple files, scrolling per line, undo/redo, syntax coloring, line numbering, and soft-wrapping overlong lines.


Usage:

nano [options] [[+line[,column]] file]...






Command Line Options:

-A
Make the Home key smarter. When Home is pressed anywhere but at the very beginning of non-whitespacecharacters on a line, the cursor will jump to that beginning (either forwards or backwards). If thecursor is already at that position, it will jump to the true beginning of the line.
pico -A ...
-B
When saving a file, back up the previous version of it, using the current filename suffixed with atilde (~).
pico -B ...
-C
Make and keep not just one backup file, but make and keep a uniquely numbered one every time a file issaved -- when backups are enabled (-B). The uniquely numbered files are stored in the specified direc‐tory.
pico -C ...
-D
Use bold text instead of reverse video text.
pico -D ...
-E
Convert typed tabs to spaces.
pico -E ...
-F
Read a file into a new buffer by default.
pico -F ...
-G
Use vim-style file locking when editing files.
pico -G ...
-H
Save the last hundred search strings and replacement strings and executed commands, so they can be eas‐ily reused in later sessions.
pico -H ...
-I
Don't look at the system's nanorc nor at the user's nanorc.
pico -I ...
-K
Interpret the numeric keypad keys so that they all work properly. You should only need to use thisoption if they don't, as mouse support won't work properly with this option enabled.
pico -K ...
-L
Don't add newlines to the ends of files.
pico -L ...
-M
Snip trailing whitespace from the wrapped line when automatic hard-wrapping occurs or when text is jus‐tified.
pico -M ...
-N
Disable automatic conversion of files from DOS/Mac format.
pico -N ...
-O
Use the blank line below the title bar as extra editing space.
pico -O ...
-P
For the 200 most recent files, log the last position of the cursor, and place it at that position againupon reopening such a file. (The old form of this option, --poslog, is deprecated.)
pico -P ...
-Q
Set the quoting string for justifying. The default is "^([ \t]*[#:>\|}])+" if extended regular expres‐sion support is available, or "> " otherwise. Note that \t stands for a Tab.
pico -Q ...
-R
Restricted mode: don't read or write to any file not specified on the command line; don't read anynanorc files nor history files; don't allow suspending nor spell checking; don't allow a file to beappended to, prepended to, or saved under a different name if it already has one; and don't use backupfiles. This restricted mode is also accessible by invoking nano with any name beginning with 'r' (e.g."rnano").
pico -R ...
-S
Use smooth scrolling: text will scroll line-by-line, instead of the usual chunk-by-chunk behavior.
pico -S ...
-T
Set the size (width) of a tab to number columns. The value of number must be greater than 0. Thedefault value is 8.
pico -T ...
-U
Do quick status-bar blanking: status-bar messages will disappear after 1 keystroke instead of 25. Notethat option -c (--constantshow) overrides this.
pico -U ...
-V
Show the current version number and exit.
pico -V ...
-W
Detect word boundaries differently by treating punctuation characters as part of a word.
pico -W ...
-X
Specify which other characters (besides the normal alphanumeric ones) should be considered as part of aword. This overrides option -W (--wordbounds).
pico -X ...
-Y
Specify the name of the syntax highlighting to use from among the ones defined in the nanorc files.
pico -Y ...
-a
When doing soft line wrapping, wrap lines at whitespace instead of always at the edge of the screen.
pico -a ...
-c
Constantly show the cursor position on the status bar. Note that this overrides option -U (--quick‐blank).
pico -c ...
-d
Interpret the Delete key differently so that both Backspace and Delete work properly. You should onlyneed to use this option if Backspace acts like Delete on your system.
pico -d ...
-g
Make the cursor visible in the file browser, putting it on the highlighted item. Useful for brailleusers.
pico -g ...
-h
Show a summary of the available command-line options and exit.
pico -h ...
-i
Indent new lines to the previous line's indentation. Useful when editing source code.
pico -i ...
-k
Make the 'Cut Text' command (normally ^K) cut from the current cursor position to the end of the line,instead of cutting the entire line.
pico -k ...
-l
Display line numbers to the left of the text area.
pico -l ...
-m
Enable mouse support, if available for your system. When enabled, mouse clicks can be used to placethe cursor, set the mark (with a double click), and execute shortcuts. The mouse will work in the XWindow System, and on the console when gpm is running. Text can still be selected through dragging byholding down the Shift key.
pico -m ...
-n
Treat any name given on the command line as a new file. This allows nano to write to named pipes: itwill start with a blank buffer, and will write to the pipe when the user saves the "file". This waynano can be used as an editor in combination with for instance gpg without having to write sensitivedata to disk first.
pico -n ...
-o
Set the operating directory. This makes nano set up something similar to a chroot.
pico -o ...
-p
Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught by the terminal.
pico -p ...
-q
Obsolete option. Recognized but ignored.
pico -q ...
-r
Hard-wrap lines at column number. If this value is 0 or less, wrapping will occur at the width of thescreen less number columns, allowing the wrap point to vary along with the width of the screen if thescreen is resized. The default value is -8. This option conflicts with -w (--nowrap) -- the last onegiven takes effect.
pico -r ...
-s
Use this alternative spell checker command.
pico -s ...
-t
Save a changed buffer without prompting (when exiting with ^X).
pico -t ...
-u
Save a file by default in Unix format. This overrides nano's default behavior of saving a file in theformat that it had. (This option has no effect when you also use --noconvert.)
pico -u ...
-v
Just view the file and disallow editing: read-only mode.
pico -v ...
-w
Disable the hard-wrapping of long lines. This option conflicts with -r (--fill) -- the last one giventakes effect.
pico -w ...
-x
Don't show the two help lines at the bottom of the screen.
pico -x ...
-z
Enable the suspend ability.
pico -z ...
-$
Enable 'soft wrapping'. This will make nano attempt to display the entire contents of any line, evenif it is longer than the screen width, by continuing it over multiple screen lines. Since '$' normallyrefers to a variable in the Unix shell, you should specify this option last when using other options(e.g. 'nano -wS$') or pass it separately (e.g. 'nano -wS -$').
pico -$ ...
-b
Ignored, for compatibility with Pico.TOGGLESSeveral of the above options can be switched on and off also while nano is running. For example, M-L togglesthe hard-wrapping of long lines, M-$ toggles soft-wrapping, M-# toggles line numbers, M-M toggles the mouse,
pico -b ...