Linux Applications

How to Copy Text from Nano Editor to Shell

To cut or copy text in Nano editor, the Ctrl+K or Ctrl+6 shortcuts are used to cut and copy, respectively. These shortcuts do not copy the text to your GNOME clipboard. Instead, they copy the text only to a special cut buffer inside the Nano editor. You cannot paste the cut or copied text from the cut buffer to anywhere outside the Nano editor, including the shell.

This article shows you how to copy text from the Nano editor to the shell through the following two methods:

  • Method 1: Using key combinations
  • Method 2: Using the right-click menu

Both methods copy the text to the GNOME clipboard instead of copying the text to the Nano cut buffer. Using either of these methods, you can copy the text anywhere outside of the Nano editor.

We have tested the procedure in the Ubuntu 20.04 LTS Terminal. The same procedure can be followed in any other Linux distribution that has the Nano editor installed.

Method 1: Using Key Combinations

To copy text from the Nano editor and paste it to the shell, follow the steps listed below:

First, mark (select) the text in the Nano editor. Place the cursor at the start of the text and press Ctr+6. Then, use the right or left arrow key to mark the required text.

To copy the marked text, use the Ctrl+Shift+C shortcut.

To paste the copied text to the shell, use Ctrl+Shift+V.

Method 2: Using the Right-Click Menu

To copy text from the Nano editor and paste it to the shell, follow the steps listed below:

First, mark the text in the Nano editor by holding the left mouse button and dragging it to the right or left to select the text.

To copy the marked text, right-click the text and select Copy from the menu.

To paste the copied text to the shell, again, right-click the text and select Paste from the menu.

About the author

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.