Copy/Paste Windows Subsystem for Linux

Trying to copy some text out of the command line output from a Windows Subsystem for Linux prompt.  I am using Pengwin Debian variant as my WSL as well as I have a X410 X-Server running.  Not sure of implications in other configurations.

Option 1: Be lazy use Windows

This counts on the direct interoperability of Windows Subsystem for Linux and it's host Windows OS, not sure this will work at all in Windows Subsystem for Linux, but it does work here

echo 'some text' | clip.exe

Here I call the command in the WSL and then pipe the output to the Windows host OS clip.exe

Option 2: Use xclip

xclip is the Linux X-Windows clipboard terminal.  You most likely will have to install it plus it's dependencies in the WSL environment i.e. sudo apt-get install xclip

In normal X-Windows you would not need to do anything more than

echo 'some text' | xclip

but seems like WSL is not targeting the proper window command combination so I needed to do the following

echo 'some text' | xclip -selection clipboard

The extra commands at the end are to use the selection target window and send directly to the registered clipboard XA_CLIPBOARD which directs to the host Windows OS clipboard

-selection
specify which X selection to use, options are "primary" to use XA_PRIMARY (default), "secondary" for XA_SECONDARY or "clipboard" for XA_CLIPBOARD