16

I like to use utilities like pbpaste on mac and xclip on linux to copy from the command line to the clipboard. I'm using windows system for linux (WSL). Is there any way of getting this behaviour from WSL. That is, I want a command line CLIP so that if I run the following in a WSL linux command line the output is written to clipboard:

ls | CLIP
Att Righ
  • 550
  • 5
  • 16
  • 2
    Does this answer your question? [Use clipboard through WSL?](https://superuser.com/questions/1618537/use-clipboard-through-wsl). Just a reminder to always search for an existing question/answer before asking a new one. While I understand that sometimes they are hard to find, this was the first result when searching the site for "wsl clipboard". Thanks! – NotTheDr01ds Nov 21 '21 at 20:51
  • Hmm... not sure how I missed that. I tired that clip.exe command before and it didn't work. But let me retry when I'm back on my windows machine. Shall we close this question as a duplicate? – Att Righ Nov 22 '21 at 14:32
  • Wait until you try it out - It does need the `.exe` extension on it, so maybe that's what you missed? But yes, if that works, I'd recommend accepting that other answer as the duplicate. Thanks! – NotTheDr01ds Nov 22 '21 at 14:44

1 Answers1

19

You may call Windows executables in WSL, only that you need the full file-name:

ls | clip.exe

Note that, unlike under Windows, the .exe part is required in WSL.

harrymc
  • 455,459
  • 31
  • 526
  • 924