How to copy all text in edited file from PuTTY to clipboard?

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


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.

enter image description here

Go to Logging -> do above settings.

Tags:

Putty