WSL2: copy to clipboard.

How to copy piped output to clipboard on Windows Subsystem for Linux 2 (WSL2).

This is a part of the 100 Days To Offload challenge.

I’m experimenting with Windows and WSL2 as my daily driver.

On Pop!_OS, I usually get my SSH key to clipboard with xclip:

cat ~/.ssh/ | xclip -sel copy

No surprise, it didn’t work on WSL2. The answer was quite simple in the end:

cat ~/.ssh/ | clip.exe

Comment via email.