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.

Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don't have time for myself any more.