Nano Commands
Nano is a relatively simple open source text editor.
*Meta <alt> requires changes to OSX Terminal.
File operations
Command
Description
Comments
nano [filename]
Opens the file in nano for editing.
Ex) nano index.html
Ctrl-r then Alt-f
Opens a new file buffer
This lets you switch between
multiple files.
Alt-> and Alt-<
Tabs between file buffers
Ctrl-o
Write changes to a file
Will prompt for file name
Ctrl-x
Quits nano
Will prompt if there are unsaved
changes.
Navigation
Command
Description
Comments
Ctrl-a
Move to beginning of current line
Ctrl-e
Move to end of current line
Ctrl-v
Move down one page
Ctrl-y
Move up one page
Alt-\ and Alt-/
Go to beginning or end of file
Alt-g
Go to a target line (and column)
number
Alt-g followed by 5,3 goes to line
five, column three
Alt-]
Go to matching grouping symbol
(parenthesis, brackets, etc.)
Copy and Paste
Command
Description
Comments
Alt-a
Selects a block; Alt-a again
unselects
Ctrl-k
Cuts from the cursor to the
Ctrl-u
Pastes clipboard to the cursor’s
position
Alt-a then Alt-^
Copies highlighted block to the
clipboard
Alt-a then Ctrl-k
Cuts a highlighted block to the
clipboard
Search and Replace
This workforce product was funded by a grant awarded by the U.S. Department of Labor’s
Employment and Training Administration. The product was created by the grantee and
does not necessarily reflect the official position of the U.S. Department of Labor. The U.S.
Department of Labor makes no guarantees, warranties, or assurances of any kind, express
or implied, with respect to such information, including any information on linked sites and
including, but not limited to accuracy of the information or its completeness, timeliness,
usefulness, adequacy, continued availability, or ownership.
Nano Commands
Nano is a relatively simple open source text editor.
*Meta <alt> requires changes to OSX Terminal.
Command
Description
Comments
Ctrl-w
Searches for a string of text
Alt-w
Repeats the previous search
Alt-r
Searches and replaces
Getting the Alt key to work on OSX:
For Terminal:
Preferences -> Keyboard tab -> Check Use Option as Meta key
For Chrome Mosh plugin:
Start the plugin -> Preferences -> Check alt-is-meta
Auto-indentation
For those wanting a quick way to auto indent code (similar to the vim command gg=G), there is a program on loki
called indent-code that will perform that action automatically. Usage is:
indent-code [filename]
This workforce product was funded by a grant awarded by the U.S. Department of Labor’s
Employment and Training Administration. The product was created by the grantee and
does not necessarily reflect the official position of the U.S. Department of Labor. The U.S.
Department of Labor makes no guarantees, warranties, or assurances of any kind, express
or implied, with respect to such information, including any information on linked sites and
including, but not limited to accuracy of the information or its completeness, timeliness,
usefulness, adequacy, continued availability, or ownership.