Under the cut, more on some of the interesting things you can do by mixing peanut butter and chocolate!
Launch Windows Explorer from Linux and access your distribution files
When you are on the WSL / bash command line and want to get visual access to your files, you can run “explorer.exe.”, Where the current directory is located, and you will get a Windows Explorer window in which your Linux files will be delivered to you through the server LAN plan9.
Use true Linux commands (not CGYWIN) from Windows
I already wrote about this before, but now there are aliases for PowerShell functions that allow you to use real Linux commands from within Windows.
You can call any Linux command directly from DOS / Windows / anything by simply placing it after WSL.exe, like this.
C:\temp> wsl ls -la | findstr "foo" -rwxrwxrwx 1 root root 14 Sep 27 14:26 foo.bat C:\temp> dir | wsl grep foo 09/27/2016 02:26 PM 14 foo.bat C:\temp> wsl ls -la > out.txt C:\temp> wsl ls -la /proc/cpuinfo -r--r--r-- 1 root root 0 Sep 28 11:28 /proc/cpuinfo C:\temp> wsl ls -la "/mnt/c/Program Files" ...contents of C:\Program Files...
Windows executables can be called / run from WSL / Linux, since the path to Windows is in $ PATH to Windows. All you have to do is explicitly call it with .exe at the end. This is how Explorer.exe works. You can also make notepad.exe or any other file.
Launch Visual Studio Code and get access to your Linux applications natively on Windows
You can run “code.” While in a folder in WSL, and you will be prompted to install the VS Remote extensions. . This effectively divides Visual Studio Code in half and runs the “headless” VS Code Server on Linux with the VS Code client in the Windows world.
You also need to install Visual Studio Code and the Remote extension - WSL . If desired, install the beta version of Windows Terminal for a better terminal experience on Windows.
Here's a great selection of articles from the Windows Command Line blog.
- Part 1 Take your Linux development experience on Windows to the next level with WSL and Visual Studio Code Remote.
- Part 2 In-depth Linux Development Guide for Windows with WSL and Visual Studio Code
- Part 3 Tips and tricks for developing Linux using WSL and Visual Studio Code
Here are the benefits of WSL 2
- Virtual machines are resource intensive and create a very independent experience.
- The original WSL was very "connected", but had rather poor performance compared to the VM.
- WSL 2 offers a hybrid approach with lightweight VMs, a fully connected interface and high performance.
Launch multiple Linux in seconds
Here I use "wsl --list --all", and there are already three Linux on my system.
C:\Users\scott>wsl --list --all Windows Subsystem for Linux Distributions: Ubuntu-18.04 (Default) Ubuntu-16.04 Pengwin
I can easily launch them, and also assign profiles so that they appear in my Windows Terminal.
Launch X Windows Server under Windows with Pengwin
Pengwin is a special WSL Linux distribution that is very cool. You can get it in the Windows Store . Combine Pengwin with an X Server, such as the X410 , and you get a very cool integrated system.
Easily move WSL distributions between Windows systems.
Ana Betts notes this wonderful technique with which you can easily transfer your ideal WSL2 distribution from one machine to n machines.
wsl --export MyDistro ./distro.tar # -, Dropbox, Onedrive, - mkdir ~/AppData/Local/MyDistro wsl --import MyDistro ~/AppData/Local/MyDistro ./distro.tar --version 2
That's all. Get the perfect Linux setup synced across all your systems.
Use Windows Git Credential Provider Inside WSL
All of the features listed culminate in this cool post from Ana Betts , where she integrates the Windows Git Credential Provider into the WSL , turning / usr / bin / git-credential-manager into a shell script that invokes the git creds manager of Windows. Ingenious. This would be possible only with clean and tight integration.
Try it, install WSL, Windows Terminal , and create a brilliant Linux environment on Windows. .