While the Windows Subsystem for Linux is great, there are some things that don't quite work easily out of the box. One of those things is copying text to clipboard. For instance, if you were following the Github tutorial for adding an SSH key to an account, you might get stuck at the following line:
clip < ~/.ssh/id_rsa.pub
Clip doesn't work out of the box with WSL, but here's a quick way to make it work natively with the Windows clipboard:
function clip() {
cat $1 | clip.exe
}
Just add this to your ~/.bashrc
file and you should be able to run commands like:
clip ~/.ssh/id_rsa.pub
To copy your public key to your Windows Clipboard for pasting into Github or wherever you need it.
If you liked this you can also follow me on Twitter, check out my GitHub, and take a look at my other blog posts.