How to paste into nano from clipboard?

217,666

Solution 1

You could try the following two commands to paste from the clipboard. Both of them should work.

  1. Ctrl+Shift+v

  2. Shift+Insert

The Ctrl+U command only allows pasting text that was copied or cut from within nano itself, hence the reason the command is not working.


Edit:

Unfortunately, for the specific case when using Vultr console, there seems to be no easy way of using copy and paste. Vultr simply does not support it. An alternative would be to use SSH together with another terminal to connect to the server. If you are on Windows, using putty would work.

Solution 2

SSH Putty windows Shift+right mouse click worked for me with default putty settings.

Solution 3

I successfully used right mouse button to paste from Windows 10 to nano on "Bash on Ubuntu on Windows".

Solution 4

nano itself has no system clipboard integration; it is dependent on the terminal's clipboard handling for interacting with it.

From the Vultr documentation:

Notes about console: The console software does not support cut & paste.

If you want clipboard handling as given in the question then you will have to use a SSH program and terminal that supports it.

Solution 5

If there is no way to do this, what native Linux editor is capable?

I'm not sure if Nano actually can do this more or less natively without explicit support from the terminal, but you may want to use X11-enabled Vim over an X11-forwarded session (ssh -X). Then "+y command will yank ("copy") to the X11 clipboard, and "+p will put ("paste") from there — without the need for terminal to support this.

Note that X11-enabled Vim doesn't mean GUI version (gVim). Console Vim can remain in the terminal, but is still able to access X11 clipboard thanks to being linked with X11 libraries. It just has to know your (forwarded) DISPLAY.

Share:
217,666

Related videos on Youtube

Oscar Chambers
Author by

Oscar Chambers

CTO at Online Blockchain PLC. I develop and deploy multiple cryptos, such as Brazio, Veggiecoin and more. Creator of: FreeFaucet.IO - the internet's most engaging cryptocurrency faucet site and educational platform Veggiecoin - An altcoin based on the bitcoin source code, committed to helping animals in need. Brazio - An altcoin based on the bitcoin source with an improved mining protocol, for the peoples of unbanked/underbanked nations. MooningMarket.Com - A cryptocurrency marketplace like ebay, powered by bitcoin BitcoinCashSurveys.Online - An easy-to-use survey platform where anyone can earn some Bitcoin Cash ThirdPartyBitcoin.Com - A bitcoin payments platform, for those from countries that do not have robust credit card / banking infrastructure. I am an avid open source contributor. Check out my open source projects featured in Forbes, or have a look at my 700+ open source github contributions this year. I do not spend a lot of time on SE, but you can sometimes find me asking legal/regulatory and medical questions that interest me, or answering programming questions.

Updated on September 18, 2022

Comments

  • Oscar Chambers
    Oscar Chambers over 1 year

    I have an Ubuntu server hosted by Vultr which I am interacting with remotely using their provided terminal. I would like to know how to paste from my clipboard into nano, which I am using to write the code for my server. I have tried Ctrl+U but this does not work for me.

    Other keyboard shortcut commands work, such as write out Ctrl+O and quit Ctrl+X, so I am sure that the Vultr terminal can recognise these keyboard commands.

    I'm sure there is a way to paste into nano from the clipboard but I'm not sure what the shortcut is.

    Question: What is the keyboard shortcut to paste from clipboard into nano? If there is no way to do this, what native Linux editor is capable?

    • jrh
      jrh over 6 years
      Did you try right clicking on the terminal that you are running your SSH session in? Some terminals use right click for paste.
  • TOOGAM
    TOOGAM over 6 years
    The paragraph after the numbered list is correct. The nano command does not try to access the clipboard of a GUI. (You may have multiple clipboards. Using Ctrl-K from nano, to cut, will use nano's internal clipboard.)
  • MechMK1
    MechMK1 over 6 years
    As a nano user myself, I can tell you that nano does indeed have a clipboard, accessed via CTRL+K to cut out a line and CTRL+U to paste it again.
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams over 6 years
    It has a cutspace, yes. But no system clipboard integration.
  • MechMK1
    MechMK1 over 6 years
    Your answer mentions nano "having no clipboard capability", which is not the same as "not integrating the clipboard of a window manager".
  • Attie
    Attie over 6 years
    @MechMK1 a "clipboard" is a system-wide concept that provides inter-application operation, nano does not support this.
  • ElectricLlama
    ElectricLlama over 6 years
    I'm using Terminus and it worked for me - yay
  • JohnC
    JohnC over 4 years
    Worked for me: Windows 10 10.0.17763 to Nano in a Linux container
  • chen
    chen almost 4 years
    It works for Windows 10 subsystem ubuntu.
  • GaTechThomas
    GaTechThomas over 3 years
    Same here. Win10 2004 19041.450.
  • xpioneer
    xpioneer about 3 years
    why this is not mentioned in the help section of nano I am wondering. how did you come to know?
  • osemec
    osemec about 3 years
    On windows it is right shift + insert.
  • kbridge4096
    kbridge4096 over 2 years
    @xpioneer from nano help: ^U (F10) Uncut from the cutbuffer into the current line. Oh, 'uncut', great.
  • neuronet
    neuronet over 2 years
    only thing that worked for me: accepted answer didn't work
  • Neeraj
    Neeraj over 2 years
    Nice! Works in Windows Terminal as well.
  • Admin
    Admin almost 2 years
    Works on macos as well