Getting Started With Nano Editor [ Quick Guide ]


Nano is one of the simplest and easy to learn text-editors out there , if you are new in system administration or just editing normal config files its become very handy to use nano .


Nano comes pre-installed in MacOSX , also in Linux distros like Ubuntu and Other Debian based distributions . You can use Pico or you can install nano in redhat or other centos Like distros simply using their respected package managers .

Update or Install ( Debian / Ubuntu / Mint )

sudo apt-get update && sudo apt-get install nano 

Centos , Fedora

yum update 
yum install nano 

For Windows :
You can download windows binaries from here :

then add binaries in windows path , to access directly from command prompt .

Interface Introduction

nano hello.txt_008


Basic Editing

Create new file :

$ nano MyFile.txt 

where MyFile is file name

Editing existing file :

$ sudo nano /etc/ssh/sshd_config

you can use nano with sudo to edit as root , and nano accept location or file name as parameter .

Buffer Navigation :

for next page

ctrl + v

for previous page

ctrl + y

Cut , Copy and paste

you can use cursor to set selection of lines then you can ctrl + U to paste
for selecting lines use ctlr + ^ ( ctrl key in linux ) same key for done selecting
use Meta + ^ to copy and Ctrl + U to paste
you can cut or delete a line just by using ctrl + k


ctrl + K    :   to cut current or selected lines 
ctrl + ^    :   to select multiple lines ( same key to unset selection ) 
meta + ^    :   to copy current line or selected lines
ctrl + U    :   to paste or uncut 

useful Shortcuts

^G (F1) Display this help text ^X (F2) Close the current file buffer / Exit from nano ^O (F3) Write the current file to disk ^R (F5) Insert another file into the current one ^W (F6) Search for a string or a regular expression ^ (M-R) Replace a string or a regular expression ^K (F9) Cut the current line and store it in the cutbuffer ^U (F10) Uncut from the cutbuffer into the current line ^J (F4) Justify the current paragraph ^T (F12) Invoke the spell checker, if available Invoke the linter, if available Invoke formatter, if available ^C (F11) Display the position of the cursor ^_ (M-G) Go to line and column number ^Y (F7) Go one screenful up ^V (F8) Go one screenful down M- (M-|) Go to the first line of the file M-/ (M-?) Go to the last line of the file M-W (F16) Repeat the last search M-] Go to the matching bracket ^^ (M-A) Mark text starting from the cursor position M-^ (M-6) Copy the current line and store it in the cutbuffer M-} Indent the current line M-{ Unindent the current line M-U Undo the last operation M-E Redo the last undone operation ^B Go back one character ^F Go forward one character M-Space Go back one word ^Space Go forward one word ^A Go to beginning of current line ^E Go to end of current line ^P Go to previous line ^N Go to next line M-( (M-9) Go to beginning of paragraph; then of previous paragraph M-) (M-0) Go just beyond end of paragraph; then of next paragraph M-- (M-_) Scroll up one line without scrolling the cursor M-+ (M-=) Scroll down one line without scrolling the cursor M-< (M-,) Switch to the previous file buffer M-> (M-.) Switch to the next file buffer

Other useful resources

Tagged With :