Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use that very often. Is there any equivalent on the WSL2 world ?


“| clip.exe” should work


That works outside WSL2, not inside, right?


clip.exe works to and from WSL 2.

But if you run VcXsrv you can use the native Linux clipboard and have it shared between WSL 2 and Windows. This is what I do because then tools like Vim, the pass utility and other command line tools can write to and read from the native Linux clipboard and everything will work out of the box.

If you wanted to reproduce pbcopy / pbpaste in native Linux or WSL 2 you can set up aliases for:

    alias pbcopy="xclip -selection clipboard"
    alias pbpaste="xclip -o"
And in case you don't already have xclip installed in WSL 2, you can apt-get install xclip or use whatever package manager you have. I can't remember if xclip is installed by default in WSL 2 distros.


Oh that’s neat. Do you use the x server for just this purpose or do you also run linux gui apps? I’ve been thinking about investing more into it but the high dpi stuff does not work properly.


I use it just for the clipboard but I used to run Sublime Text through it years ago (using WSL 1). It was really fast and worked great, at least at 2560x1440.

A video walk through of my current Windows / WSL 2 / etc. dev environment is here: https://nickjanetakis.com/blog/a-linux-dev-environment-on-wi...


ls | yank -- clip.exe




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: