Nano – How to Copy (Only Copy, Not Cutting) in Nano

nano

I need to copy some text in Nano, so I searched using Google and found a few posts here on Stack Exchange and other sites in which the OP asks "How can I copy?" and people usually answer "You can use ctrl+K". The person asks how to copy and they are told how to cut.

Other answers mention alt+6 but in my testing it doesn't work.

Is there no option to copy text in Nano? Is there a workaround?

Best Answer

  1. Position the cursor at the beginning of the character from which you want to copy. Press Alt+Shift+A to set mark. ( Alternatively, set mark with Ctrl+6 )

  2. Use arrow keys to highlight the text to copy. highlight with nano image

  3. Use Alt+Shift+6 to copy (Alternatively, Alt + 6 )

  4. Navigate to the place you want to paste. Release paste with Ctrl+U

    paste image

Where is reference to these keybindings

All of these are defined under the documentation, which you can access with Ctrl+G at any point. Note that leading ^ stands for Ctrl and M for Alt in the documentation, since this is traditional way of Unix defining meta characters. Lines from documentation:

^^ (M-A) Mark text starting from the cursor position

and

M-^ (M-6) Copy the current line and store it in the cutbuffer

Related Question