Tag Archives: nano

Ubuntu Server: Nano: Go to End of the File Tips, Tricks and Tutorials 19 MAY 2014

I use GNU nano as my default text editor when working on my Ubuntu Server installs, primarily for its relative ease of use (well, at least compared to VIM that is). I often encounter files (particularly log files) which contain a ridiculous number of lines and so it is useful to know how to jump straight to the end of the file, hence this note to myself here.

The shortcut to jump to the bottom of the file is:

'Ctrl' + '-' ...followed by 'Ctrl' + 'v'

So the press sequence is first Ctrl then Hyphen/Underscore and when prompted to “enter line number, column number”, follow with a Ctrl and ‘v’.

Interestingly enough, to achieve the opposite of this, in other words jump to the top of the file, substitute the [Ctrl + v] for [Ctrl + y]:

'Ctrl' + '-' ...followed by 'Ctrl' + 'y'

And that is all there is to it – quick and easy!

ubuntu linux nano editor screenshot

Related Link: GNU nano

Ubuntu: How to jump to the next Search Result in Nano Software & Sites 26 MAR 2013

ubuntu-10-logoGNU nano is a simple terminal-based text editor. Though not as powerful as Emacs or Vim, it is (relatively) easy to learn and use, and has been part of a standard Ubuntu installation for years now.

Ctrl+w is show as the shortcut to initiate a simple text search, but frustratingly enough, it isn’t immediately obvious to jump to the next search result. As it turns out, to do this is simple enough: Alt+w will actually repeat the search, in other words jump to the next search result!

You’ll also notice when entering a search term at the start of a search operation, pressing the up and down arrows will allow you to cycle between terms previously searched on!

Oh, and to toggle searching backwards as opposed to forwards, you’ll need to press Alt+b.

And now you know.

Ubuntu: How to Copy a Line in Nano CodeUnit 06 FEB 2011

Nano is an extremely handy and lightweight text editor that comes with most Linux distributions these days. Today’s tip will teach us how to copy and paste a line or piece of text within a text document.

The first method to copy and paste a line of text is to make imaginative use of the existing ctrl+k cut text and ctrl+u uncut text command. Basically you use ctrl+k once to cut the whole line of text you wish to copy, then use ctrl+u to place it back in the place you cut it from and then move the cursor to where you want the text to appear and press ctrl+u once again.

The second method is to make use of the alt+6 key combination to copy the current line into the buffer. Again, the ctrl+u keypress will paste the buffer content’s back into the document. This can be combined with the alt+m+a key combination which first enables mouse support for nano, then allows you to set a mark to indicate the end of the text you wish to copy. Once the mark has been set, alt+6 will copy it and crl+u will paste it.

And now you know. Nifty.

Ubuntu Server: Enable Nano Syntax Highlighting CodeUnit 27 NOV 2010

Although newer versions of Ubuntu (10.04 and up) already come with the helpful nano syntax highlighting enabled, older versions don’t – though thankfully switching this on is pretty simple to achieve.

To enable nano syntax highlighting for a user, first copy the nanorc file to the users home directory:

cp /etc/nanorc ~/.nanorc

Next, edit the file, scrolling down to the bottom of the file and uncommenting the lines for the languages you wish to turn syntax highlighting on for.

nano ~/.nanorc

Save your changes and fire up nano against a file with a recognised language extension to see the colorful result.

Easy peasy :)