Nano text editor command cheatsheet

File Control in nano

    nano index.php Open or create the file “index.php” with nano on command line.
    Ctrl-o Y Enter Save changes.
    Ctrl-r Alt-f Open a new file with a new buffer within nano.
    Alt-> Switch to the next file buffer in nano.
    Alt-< Switch to the previous file buffer in nano.
    Ctrl-x Quit nano.

Navigating through file contents in nano

    Ctrl-a Move to the beginning of the current line.
    Ctrl-e Move to the end of the current line.
    Ctrl-v Move down one page.
    Ctrl-y Move up one page.
    Alt-\ Go to the beginning of the file.
    Alt-/ Go to the end of the file.
    Alt-g Go to a target line number.
    Alt-] Jump to matching open/close symbol.
    Alt-a Alt-} Select a block and indent the block.
    Alt-a Alt-{ Select a block and outden the block.

Copy and Paste in nano

    Alt-a To select a block for copy or cut operation, do Alt-a again to unselect.
    Alt-a Alt-^ Copy a highlighted block to the clipboard.
    Alt-a Ctrl-k Cut a highlighted block to the clipboard.
    Ctrl-k Cut from the current cursor position to the end of the current line.
    Ctrl-u Paste the contents from the clipboard at the current cursor position.

Search and Replace in nano

    Ctrl-w Search for a target string.
    Alt-w Repeat the last search.
    Alt-r Search and replace.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search