7

I am connected from windows to linux using Putty. I have a file result.csv I want to copy all the text from this file to windows clipboard and then paste the text to a notepad? Please help me.

8

On the Linux machine, logged into within PuTTY, cat result.csv. Within the PuTTY-window, hold shift and mark what you want to copy. That should be copied to Window's clipboard then.

  • 2
    PuTTY behaves unusually for Windows: anything you highlight by shift+drag (including autoscroll at top/bottom) or double or triple click (word or line) is immediately copied; conversely rightclick justs pastes and does not pop a menu. This method works as long as the data fits in scrollback memory, which you can adjust in the config dialog at Window (although if I try more than about 15million lines it thrashes and dies; using 0.64 on W8.1-64bit). – dave_thompson_085 Apr 3 '16 at 4:49
4

So my suggestion would be to copy the file to your local computer using scp instead. If you have ssh working then you should have the possibility to connect with scp.

Try using a program called winscp

  • Since the OP is using PuTTY, why do you recommend winscp instead of pscp or psftp? – Gilles 'SO- stop being evil' Apr 2 '16 at 20:17
  • You are right any scp client will work. Personally if I don't have cygwin around I'm going with winscp to avoid the pain of using cmd. – morholt Apr 2 '16 at 20:29
3

Nano is a terminal application, so it doesn't have cross-application copy-paste, only an internal clipboard.

It's possible to copy a file to the clipboard on a Linux machine, but that requires a GUI (an X server), you can't do that with a pure text connection. You can actually use PuTTY to make a text+graphics connection by activating X11 forwarding, but that requires additional software on the Windows side, because Windows doesn't support X11. If you want to do that, see How to use X11 forwarding with PuTTY or Installing/Configuring PuTTy and Xming or X11 Forwarding using Xming and PuTTY. Then you can use xsel -b <myfile.txt or xclip <myfile.txt to copy the content of myfile.txt to the clipboard.

Alternatively, you can use the PuTTY companion programs PSFTP and PSCP to copy files.

  • Why not call an "internal clipboard" a buffer? – Sergey Bushmanov Jan 10 at 7:34
  • @SergeyBushmanov Why call an internal clipboard a buffer? That's a very generic term and not particularly appropriate there. – Gilles 'SO- stop being evil' Jan 10 at 19:38
  • Because it's called so in the nanorc, and my understanding system clipboard -- where clipboard is appropriate I believe -- is different from nano's buffer. This is why the OP, and this is why I came here. Am I missing something? – Sergey Bushmanov Jan 10 at 20:29
  • @SergeyBushmanov Ah, ok, I didn't realize nano called it a buffer (or rather a cutbuffer, which is a precise term). Clipboard is the modern term that everyone understands these days. "Buffer" is a very generic term and I thought mostly only vi(m) users would use the term in that sense nowadays. The difference between the system clipboard and nano's is that nano's is internal to nano, whereas a system clipboard allows copying between applications. That is the important difference and not the name. X11 has an inter-application "cutbuffer" as well as an inter-application "clipboard". – Gilles 'SO- stop being evil' Jan 10 at 22:11
1

If you have a file open in nano in a putty window, you will have to turn off mouse support (Alt-M will toggle). After that, you can select text in nano with the left mouse drag. Then left-click on the selected text to copy it to the windows clipboard. Anywhere you can now paste that clipboard text with a right-click. I often use this method to copy a single command from a bash script file, open in nano, to the bash command line to execute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.