Introduction to Nano Editor

Using Nano Editor

How to Cut, Copy and Paste in Nano Text Editor

In this quick Nano tutorial, learn about cut, copy and paste.

Copying, cutting, and pasting are the most basic tasks in text editing but if you are new to the nano, you may find it complex to perform those basic tasks.

To make things easy to understand, I have divided this guide into 3 parts:

  1. Copy text in the nano text editor
  2. Cut text in the nano text editor
  3. Paste text in the nano text editor

So let's start with the first one.

How to copy text in the nano text editor

There are two ways you can copy text in the nano text editor:

  1. Using mouse (easy)
  2. Using keyboard

I would recommend going with the first method if you are a beginner and don't want to overwhelm yourself with shortcuts.

Use the mouse to copy the text in the nano text editor

To copy text using the mouse, all you have to do is follow two simple steps:

  1. Select text using the mouse
  2. Right-click and select the Copy option

Sounds complex? Let me show you how you pull that off:

Copy text in the nano text editor using mouse

Use keyboard to copy text in the nano text editor

While using the mouse looks super convenient way to copy text, it won't let you select anything outside of what is being shown on the terminal screen.

There comes the magic of using keyboard shortcuts that let you do things that your mouse won't.

To use this method, you have to follow 3 simple steps:

  1. First, go to the point from where you can start the selection of text and press Ctrl + 6 to set the mark.
  2. Now, use the arrow keys (or even Home, End, Page Up, and Page Down keys for faster selection) to select the text. The selection will be highlighted.
  3. Once done, press Alt + 6 to copy the selected area.

Here is how you perform those 3 steps to copy text:

Copy text in the nano text editor using keyboard shortcuts

How to cut text in the nano text editor

Unlike the copy operation, you can not use the mouse to cut text so you are only left with the keyboard method.

Don't worry, it is very similar to copying text using the keyboard and can be done in 3 easy steps:

  1. Navigate to the point from where you want to start selecting text and press Ctrl + 6 to set the mark.
  2. Now, use the arrow keys to select lines.
  3. Use Ctrl + K to cut the selected text.

Sounds difficult? Here's how to cut text using the above steps:

Cut text in the nano text editor

How to paste text in the nano text editor

πŸ“‹
If you copied text and want to paste it, then you can use the mouse by right-clicking and selecting paste.

Once you are done copying or cutting text, you can paste it using the Ctrl + U shortcut.

Want detailed steps to do so? Just follow these 2:

  1. Navigate to the point where you want to paste the text.
  2. Press Ctrl + U to paste the text.

In the below example, I copied text and then pasted it for your reference:

paste text in the nano editor

That's it!

Get more out of the nano text editor

If you are just getting started with the Nano text editor or want to learn more about its features, you can refer to our detailed guide on using Nano:

Editing Files With Nano in Linux [With Cheat Sheet]
Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.

Here's a detailed guide on how you edit files in the nano text editor:

Linux Terminal Basics #9: Editing Files in Linux Terminal
Learn about editing text files in the Linux terminal using the beginner friendly Nano editor in the second last chapter of this series.

I hope you will find this guide helpful.