Showing posts with label nano text editor. Show all posts
Showing posts with label nano text editor. Show all posts

Thursday 10 November 2011

How To Reach To The End Of File In Nano Editor

Sometimes the file you are working on is so long that you might want to know some shortcut rather than going through each and every entry to reach the end of file. Here I am sharing the shortcut to reach at the end of line which will prove useful several times while working with nano editor.

To reach the end of the file, you can use one of the two shortcuts available in nano.

The first one is Alt + / and the second one is Ctrl + w + v. You can use either of these. Personally I am used to use the first one. By the way, if you want to reach to the top of the file, you can use the shortcut Alt + \.

I hope it proves useful for you.


Read more...

Tuesday 8 November 2011

How To Go To Specific Line Number In Nano

Nano is a light-weight command line text editor that will be very useful in many cases such as while editing files on remote server through SSh. Numerous times, you want to jump to the specific line and this is very easy in nano editor.

First we need to know the line number and I usually use grep to do so. The grep -n switch will output the line number. Now if you know the line number, you can use either of the following ways to go to the specific line number.

First way is to open nano directly to the line of the file you want to reach. The syntax is something like below:

nano +104 file.sh

The above command will directly take you the line number 104 of file.sh file. Now, if you are already in nano and you want to reach to some specific line number, use the shortcut Ctrl + _ (underscore == Ctrl + Shift + -). Nano will ask you the line number to go to and enter the line number you want to go to. Another equivalent shortcut is Alt + g which I just discovered today.

I hope this helps. :)



Read more...