Cut, Copy and Paste in Nano

GNU Nano is an editor that has a minimal learning curve and hence is widely used for beginner-level guides.

That doesn't mean that it is as easy to use for beginners as a graphical text editor. Why? because you still have to rely on the keyboard shortcuts to do the basic things such as save, undo, etc.

How about cut, copy and paste in Nano? Does it require specific keyboard shortcuts too?

Well, yes and no. You can use the mouse to copy-paste. There are also keyboard shortcuts for the same purpose. To cut, you must use shortcuts.

Let me show all this to you in detail.

Copy text in Nano

To copy a piece of text, the text needs to be selected first.

There are two ways to copy the text in Nano:

  • Use the mouse to select and copy
  • Use the keyboard to select and copy

Using mouse to select, copy and paste

If you want a quick and dirty selection to copy text, there is no better way than using a mouse to do it.

Below are the steps you can follow:

  1. Click and drag the cursor to select text
  2. Right click and click on "Copy"

Once the text is copied to clipboard, to paste text using mouse, make sure that you have moved the cursor to the location where you want to paste text.

Then, do a right click, and select "Paste" from the context menu that popped up.

This is what you should do to select, copy and paste text using mouse.

Using keyboard to select and copy (for pros)

Using a mouse to copy text is all good, but when you have to select text that extends the page, it gets frustrating. For that, you will need to use a few keyboard shortcuts.

Below are the steps to select and copy text using keyboard:

  1. To select text, press the Ctrl + 6 key combination. You will see "Mark Set" appear at the bottom of the screen as an acknowledgement.
  2. Now, use the arrow keys (keys like Home, End, Page Up and Page Down can also be used) to select/highlight text.
  3. To copy selected text, press Alt + 6 key combination.

You now have the text copied to your clipboard!

Cut text in Nano

The cut operation is very similar to the copy operation, the only difference is that the data is deleted from one location to be moved to another location.

Unfortunately, cutting text cannot be done with the use of a mouse, so let's go over the steps to follow if you want to cut text.

  1. Select text using the Ctrl + 6 key combination.
  2. Use the arrow keys to highlight the text you want to cut.
  3. To cut the selected text, press Ctrl + K (think of it as Kutting text).

That is all there is to kutting text :D

💡
If you press Ctrl+K without selecting any text, it cuts the entire current line.

Paste in Nano

Finally, after copying or cutting the text, it won't be much of a use if you can not paste text.

Thankfully, pasting text in nano is very easy. Follow the steps given below:

  1. Move your cursor to the location where you want to paste text
  2. Press Ctrl + U
💡
Nano shows the keyboard shortcuts at the bottom of the screen all the time. So, even if you forgot it, you can always look at the bottom of the editor for hints or press Ctrl+G for help. If it says ^K for Cut, use Ctrl+K (^ means Ctrl key). Similarly, if it says M-A for Append, use Alt + M (M means Alt key).

Copy-paste between Nano and the system

If you want to copy text from a web browser or other editor into Nano, use the Ctrl+Shift+V to paste the text into Nano.

Similarly, if you want to copy some text from Nano to an external application, use Ctrl+Shift+C to copy the text and then the usual Ctrl+V to paste it.

When you use Ctrl+Shift+C/V keys, the text is copied into the system buffer and hence it can be used outside the Nano editor as well.

If you use the Nano specific keyboard shortcuts such as Ctrl+K etc, the text stays in Nano buffer. It cannot be accessed at the system level and hence you cannot use it outside Nano.

Conclusion

GNU Nano is a simple text editor that is known best for getting the job done without much fuss. This article covered the basics of copying, cutting and pasting text in Nano.

If you are interested in mastering the basics of Nano, try this free course on Nano.