Nano

How do I copy from the clipboard to Nano?

When we cut or copy a text within the Nano editor, it is saved to a special buffer known as Cutbuffer. Remember Cutbuffer is not the same as a clipboard. The clipboard is maintained by Gnome and it only saves the text that is copied using the mouse right-click menu or using the Ctrl+Shift+c keyboard shortcut.
In the following article, we will show you how to copy from Cutbuffer and Gnome Clipboard to Nano editor. The commands have been tested on Ubuntu 20.04 LTS Terminal.

Copy from Cutbuffer to Nano

To mark (select) the text in Nano editor, place the cursor at the beginning of the text and use the following shortcut.

 Ctrl+6

Or

 Alt+a

Then use the arrow keys to mark the text forward or backward. To unmark the text, use the same shortcuts again.

To cut the marked text in Nano editor and save it to Cutbuffer, use the following shortcut:

Ctrl+K

If you need to cut the entire line of text starting from the current cursor position, just press Ctrl+K without marking the text.

To copy the marked text in Nano editor and save it to Cutbuffer, use the following shortcut:

Alt+^

Or

Alt+6

To copy the saved text from Cutbuffer to Nano, place the cursor at the required position, and use the following shortcut:

Ctrl+u

It will paste the copied text to the nano editor.

Note: The text copied to Cutbuffer can only be pasted inside the Nano editor’s current session. Also, note that, when we close the Nano editor, the cut buffer is emptied.

Copy From Cutbuffer to Nano

Copy from Clipboard to Nano

When you copy a text anywhere inside your desktop using the mouse right-click menu or using the Ctrl+Shift+c, this text is not saved to Cutbuffer. Instead, it saved to Gnome clipboard.

Copy from Clipboard to Nano
To paste the copied text from Gnome clipboard to Nano editor, use the following shortcut:

Ctrl+Shift+v

or
Use the mouse right-click menu to paste this text in Nano editor.

Copy from Clipboard to Nano

Note: The text copied to Gnome clipboard can be pasted to any program or window including the Nano editor.

About the author

Karim Buzdar

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.