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.
5 Answers
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.
-
3PuTTY 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). Commented Apr 3, 2016 at 4:49
-
it never copy from nano online server to my windows notepad the only thing saves me was the
winscp
Commented Oct 2, 2021 at 15:07
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? Commented Apr 2, 2016 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.– morholtCommented Apr 2, 2016 at 20:29
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.
-
-
@SergeyBushmanov Why call an internal clipboard a buffer? That's a very generic term and not particularly appropriate there. Commented Jan 10, 2021 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? Commented Jan 10, 2021 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". Commented Jan 10, 2021 at 22:11
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.
If you have the file open in Putty. Press ESC and then $ which enables "soft Wrapping" which will make the contents wrap as you would usually see in a text editor.
You can then highlight the contents as usual and paste them into your desktop file.