Working with nano editor
Nano is a small, free and friendly editor which is developed to remove the overcomes of Pico editor. Nano is a mode less editor so you can start typing immediately to insert text.
How to install nano editor?
Nano editor can be installed as follows
- From source
You need to download a source code of nano editor from below mentioned link or from official link
- Link to download nano editor https://www.nano-editor.org/download.php
- Extract this file using a suitable command like : tar -xvzf nano-2.8.4.tar.gz
- cd nano-2.8.4
- make install
- Using terminal
nano editor can be installed by typing a small command on the terminal as follows
$sudo apt-get install nano
How to create a file using nano editor?
Within working directory
$nano [option] file_name
Out of working directory
$nano [option] pah/to/destination/file_name
Top five options for nano editor
- + line_number,column_nmuber ($nano +4,7 file_name) : You will find your cursor in 4th row and 7th column of your file
- -B (backup): When saving a file, back up the previous version of it to the current filename suffixed with a ~
- -L(nonnewlines): Don’t add newlines to the ends of files
- -N (nonconvert): Don’t convert files from DOS/Mac format
- -k(cut): Cut from the current cursor position to the end of the current line
How to quit a file from nano editor?
A file can be quit by pressing Ctrl + x
Next, it will ask, Save modified buffer (ANSWERING “No” WILL DESTROY CHANGES)?
- To save, you have to press Y/y else N/n
- To cancel, you have to press Ctrl + c
How to copy/cut and paste content in nano editor ?
- To copy a word or line
- Position the cursor at the beginning of the character from which you want to copy. Press Alt + a or Ctrl + 6
- Use arrow keys to highlight your desired word or line to copy
- Use Alt + 6 to copy your highlighted word or line
- Now, navigate to the place you want to paste. Release paste with Ctrl + u
- To cut a single line from your file
- You need to come at beginning of your line and punch Ctrl + k , now your line will disappear from there.
- To paste this line, you need to punch Ctrl + u
- To cut multiple lines from your file
- You need to come at beginning of the line from where to want to cut, now punch n time Ctrl + k (where n is number of lines which you want to cut )
- To paste these lines, you need to punch Ctrl + u
- To cut n number of words from a line
- First, you need to come at the beginning to words which you want to cut.
- Now press Alt + a or Ctrl + 6
- Now move your cursor to the end of the text you want to cut: the marked text gets highlighted
- If you need to cancel your text marking, simply hit Alt + a or Ctrl + 6
- To cut these selected words, press Ctrl + k
- To paste, press Ctrl + u
How to search a string in nano editor?
- In nano editor, you will find whereis instead of search
- To search a string, you need to hit Ctrl + w
- At bottom of your file, you will find a blinking cursor where you have to type your desired string or character
- Finally hit Enter
- Your cursor will jump to the beginning of your string which you wanted to search.
Nano’s enhancement above pico
- Search and replace
- Go to line and column number
I am pleased to inform that you can also write articles for PaperGuide. Visit our page Join PaperGuide for more details or send your detailed resume along with a sample article ( atleast 1000 words ) at email@example.com.