13

In addition to this question: PuTTY how to select text and copy text using keyboard ONLY

I want to copy all text from file that I see in PuTTY to my Windows session. Something that in Windows would be done with Ctrl + A.

What is the equivalent in PuTTY?

Edit:

What I actually have is a long text file.
In Putty I can forward to the "next page" using Ctrl + V or simply going down with the arrow rows. The limit of row that I can see is with the height of my screen. If I could to see all of them I would simply mark them and copy them.. But I can't....

Think of it like a 400 pages long of word document you simply click Ctrl + A in the document and then you can copy it all. This is what I need in PuTTY.

6
  • copy all text from file that I see - That's pretty vague. How do you "see" it? What tool/command do you use to "see" it? – Martin Prikryl Mar 7 '17 at 7:59
  • @MartinPrikryl Please see my edit – avi Mar 7 '17 at 8:02
  • Check my answer - Though you still didn't explain what tool/command do you use to "see" the file. – Martin Prikryl Mar 7 '17 at 8:07
  • You have actually asked this already few months back: superuser.com/q/1156010/213663 – Martin Prikryl Mar 7 '17 at 8:30
  • Your edit does not change anything, we understand, what you want! It cannot be done! Again, as per my answer. PuTTY cannot access the other lines on your remote editor. And the remote editor cannot access the local clipboard. The period. There's no way around that! Use a local editor that supports SFTP or SFTP client with editing capability. See winscp.net/eng/docs/ui_editor – Martin Prikryl Mar 7 '17 at 9:02
12

You can select all text in PuTTY by clicking the title bar icon and selecting "Copy all to clipboard":

putty select all

This will only copy the entire scrollback buffer. If your file is longer than the scrollback buffer, you will have to increase it. This can be done under "Window"->"Lines of scrollback".

putty scrollback

5
  • Thanks this is better but this doesn't solve the issue. My file is very long... it copy the entier session but from the file it copy only the visible section... try do that with a long text file you'll see it doesn't copy it all. – avi Mar 7 '17 at 7:56
  • @avi Updated my answer. Probably your scrollback isn't big enough to hold the entire file. You should consider using SCP (WinSCP/pscp.exe) to transfer the file though. – mtak Mar 7 '17 at 8:23
  • Ok I found why you didn't understand me. I used nano file.py which didn't show the whole file.. now I use cat file.py and your solution works. cat loads the entire file to the console so you can scroll up and down the file and then I can mark it and copy it. it's important to highlight that cat command needs to be used to solve it :) – avi Mar 7 '17 at 9:02
  • So it's the same as superuser.com/questions/741526/… ? Maybe do a better search next time :) – mtak Mar 7 '17 at 9:46
  • Putty for linux does not have an option to right click & copy all to clipboard – user1502776 Jul 15 '18 at 8:08
4

Using an SSH terminal to copy file contents is not the best way. Use an SFTP client to download the file. Or even to edit it directly (if that's the ultimate goal).


Anyway, to answer your question:

  • In PuTTY, while you are connected, go to Change Settings > Windows > Control the scrollback in the window > Lines of scrollback and enter enough lines to fit your whole file.
  • Type cat filename on command prompt.
  • Use the Copy All to Clipboard command.

If there's anything in the "history" of the session already, clear it beforehand:

  • Press Ctrl+L to clear the visible screen.
  • Use the Clear Scrollback command.

You cannot copy a complete contents of a text-based editor, that you see in the PuTTY console.

  • For PuTTY the "screen" is a "black box". It does not know that there's more contents, than it sees.
  • And the remote editor does not have an access to the local clipboard.
0
3

enter image description here

Go to Logging -> do above settings.

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.