Copy the contents of a file to clipboard from WSL to Windows?

Command: cat /path/to/file | clip.exe Description: cat command put the file contents to the output. It is then pipe to the clip.exe, a Win32 program, redirects output to the Windows clipboard. Do not forget to add the .EXE extension of the later one. There are multiple cat alternatives can be used, see this and this. … Read more

Mounting a windows share in Windows Subsystem for Linux

Assuming the host Windows OS can access a file share at “\\servername\sharename”, try this command in bash. You will need to be root: mkdir /mnt/mountedshare mount -t drvfs ‘\\servername\sharename’ /mnt/mountedshare The single quotes are important! Worked for me with a SharePoint Online UNC path. The permissions are screwy though. I can navigate through the folders … Read more

Visual-Block mode not working in Vim with C-v on WSL@Windows 10

CTRL+v is bound to paste in Windows Terminal by default. As of now, the only thing that’s working is to disable that behaviour in the settings.json. You can do that by pressing CTRL+SHIFT+,. From version 1.4 “actions”: [ … // { “command”: {“action”: “paste”, …}, “keys”: “ctrl+v” }, <—— THIS LINE Pre version 1.4 “keybindings”: … Read more

How to get VirtualBox 6.0 and WSL working at the same time [closed]

I found it! After much research, and trial and error, here is what enabled me to run VMs in VirtualBox on Windows 10 with Windows Subsystem for Linux installed: In an elevated (admin) cmd.exe or PowerShell, do: bcdedit /set hypervisorlaunchtype off and make sure Hyper-V and Windows Sandbox are disabled in Windows Features (which you … Read more

Run Docker on Ubuntu on Windows Subsystem for Linux

Finally, I could run Docker on WSL in an easy way: You need first to install and run Docker Engine on Windows and then just create a symbolic link on Ubuntu bash pointing to the Windows executable: sudo ln -s /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker.exe /usr/bin/docker This link works because from version Windows 10 Creators Update it’s possible … Read more

Access a localhost running in Windows from inside WSL 2 [closed]

Short answer for most recent Windows versions mDNS has been a feature of WSL2 for a while now. Concatenating your WSL2 hostname (or the equivalent command/function in your programming/language environment) with “.local” should get you access. For example, from Bash, try: ping “$(hostname).local” For instance, if your hostname is “MyComputer”, then the mDNS should be … Read more

Access a web server which is running on WSL (Windows Subsystem for Linux) from the local network

None of the existing answers work for me, as WSL2 is running in its own VM and has its own network adapter. You need some sort of bridge or port forwarding for non-localhost requests to work (i.e. from another host on the same network). I found a script in https://github.com/microsoft/WSL/issues/4150 that worked to resolve the … Read more