Ssh – How to copy terminal output from an ssh console and paste it into local windows notepad window

ssh

I have ssh'ed into a Linux console using the Cygwin ssh command. after running a command I need to copy several lines of the output and paste them into a windows notepad window.

The problem is that I cannot use the mouse in my ssh session because I am blind, so left-clicking and dragging to the bottom of the area to copy won't work for me.

Are there any keyboard ways to accomplish this?

BTW: I am trying to copy a 3 or 4 line randomly generated activation key for some software which I need to save.

An addition to this question is the command I am running presents this long activation key which actually has to be pasted into a website to generate a token which then has to be pasted into the terminal which is waiting for input after displaying the activation key.

I know I can use the right-click or ctrl+ins keys to paste the token back into the terminal, but I need to get the activation key.

Redirecting to a file won't work because of the second step of the process.

Best Answer

There is a keyboard shortcut - Alt-Space will open the Control menu for the active window, which will have an Edit sub-menu. Mark will allow you to select an area, and the Enter key will copy the selection to the clipboard for pasting elsewhere. I do not know the keyboard shortcuts for demarking the selected area to be copied, and unfortunately do not have a Windows machine to hand upon which to experiment.

If the text you need to copy is the output of a command, you could redirect the output into a file (e. g. /path/to/sometool > myfile.txt) and then open that file in Notepad directly.

Related Question