Version 1. Read about the new features and fixes from March. You can develop in a Linux-based environment, use Linux-specific toolchains and utilities, and run and debug your Linux-based applications all from the comfort of Windows. This lets VS Code provide a local-quality development experience — including full IntelliSense completionscode navigation, and debugging — regardless of where your code is hosted.
Install the Windows Subsystem for Linux along with your preferred Linux distribution. Also, extensions installed in Alpine Linux may not work due to glibc dependencies in native code inside the extension.
See the Remote Development and Linux article for details. Install the Remote Development extension pack.
Type code. This should only take a short while, and is only needed once. Note: If this command does not work, you may need to restart your terminal or you may not have added VS Code to your path when it was installed. Once finished, you now see a WSL indicator in the bottom left corner, and you'll be able to use VS Code as you would normally! That's it! Any VS Code operations you perform in this window will be executed in the WSL environment, everything from editing and file operations, to debugging, using terminals, and more.
You will be prompted which distro to use. To open a WSL window directly from a Windows prompt use the --remote command line parameter:. If you are working with the same repository in WSL and Windows, be sure to set up consistent line endings. See tips and tricks for details. See tips and tricks to for details. If you install an extension from the Extensions view, it will automatically be installed in the correct location.
Once installed, you can tell where an extension is installed based on the category grouping. Note: If you are an extension author and your extension is not working properly or installs in the wrong place, see Supporting Remote Development for details.
Local extensions that actually need to run remotely will appear Disabled in the Local - Installed category. Select Install to install an extension on your remote host. You can also use the code command line from this same terminal window to perform a number of operations such as opening a new file or folder in WSL.
Type code --help to see what options are available from the command line. Once you've opened a folder in WSL, you can use VS Code's debugger in the same way you would when running the application locally. For example, if you select a launch configuration in launch. See the debugging documentation for details on configuring VS Code's debugging features in.
While this keeps your user experience consistent, you may want to vary some of these settings between your local machine and WSL. These will override any local settings you have in place whenever you open a folder in WSL. This was done to avoid issues with startup scripts that are tuned for shells. If present, the script is processed before the server is started.
The script needs to be a valid Bourne shell script. Be aware that an invalid script will prevent the server from starting up. If you end up with a script that prevents the server from starting, you will have to use a regular WSL shell and delete or rename the setup script.Access the Linux terminal on Windows, develop cross-platform applications, and manage IT infrastructure without leaving Windows.
In seconds, be able to access the linux terminal and run Linux applications and workflows on your Windows machine. From the same workstation, manage mixed Linux and Windows infrastructure both on-prem and across public clouds.
Spin up Node. Install compilers and libraries from the Ubuntu repository, maintained by Canonical. We are extending enterprise support for Ubuntu from Azure to Windows workstations creating a seamless operating environment. Achieve the same first-class, out-of-the-box, compliant security that is synonymous with Ubuntu. Ubuntu is intuitive, user-friendly, and offers the flexibility for customizations when operating within WSL.
Download from the Microsoft Store. Access the Linux terminal on Windows In seconds, be able to access the linux terminal and run Linux applications and workflows on your Windows machine. Manage IT infrastructure From the same workstation, manage mixed Linux and Windows infrastructure both on-prem and across public clouds. Editors Run your choice of Linux text editors, including vim, emacs, and nano. Servers Spin up Node. Development Install compilers and libraries from the Ubuntu repository, maintained by Canonical.
Shells Use your choice of Linux shells, such as bash, zsh, and fish. Scripting Automate Linux and Windows tasks with advanced bash scripting.
Security Leverage Linux security tools to test and harden your network. Data Crunch big numbers with tools for R and Python.Learn how to install WSL 2
Kubernetes Build, test, and deploy Kubernetes clusters on Windows. Security Achieve the same first-class, out-of-the-box, compliant security that is synonymous with Ubuntu. Easy to Use Ubuntu is intuitive, user-friendly, and offers the flexibility for customizations when operating within WSL. Run Ubuntu from the Start Menu. Select a username and password for your administrative user. WSL 1 Powered by a Linux binary translation layer. Supported on all versions of Windows 10 since Fall Creators Update.
Features significant speed and networking improvements. Currently only available through the Windows Insiders program. Supported on all editions of Windows How to Enable WSL 2.If you've spent way too much time partitioning hard drives to have several Linux distros installed with Windows, you're in luck with this article.
WSL makes running a Linux distribution alongside Windows so much easier, and more flexible. In this tutorial, you'll learn how to get started with WSL. You'll learn how to get started to learning how to use some nifty tools making WSL even more versatile than using bash or PowerShell on their own.
We'll go deeper into that topic later. For now, it's important to understand a little more about what WSL is doing under the hood. If you have the Windows 10 build or higher, you should run WSL2. Even if you don't, everything else in this post will work for either version. The main difference between them comes down to system call syscall ; a programmatic way an operating system calls a service.
Syscall can get complicated quickly. I won't go into syscall here, but if you'd like to read more about it check out MSDN article here. At a high level, when you run a command through WSL, syscall uses a driver to interpret that on the Windows kernel. WSL2 then uses a virtualized Linux kernel that's running in the background and gets updated through Windows update. Setting up Windows Subsystem for Linux involves installing a Linux distribution alongside Windows But in a way that allows the two different operating systems to interact with each other.
To install Windows Subsystem for Linux on Windows, the only requirement is that you have a bit Windows 10 device.
Different versions of WSL require different builds of Windows, but they can run alongside each other. If you're more of a visual learner, feel free to watch this TechSnips video on how to get WSL up and running.
As mentioned earlier, certain builds of Windows 10 are required for using WSL. To make sure you can use any given version of WSL, first check which build of Windows you are running. There are a few different ways to do this, but the easiest two are from cmd or PowerShell.
In a command prompt, run systeminfo. Here you will see your Windows 10 operating system version near the top of the results as shown below. In PowerShell, you can check the Windows registry to find your Windows 10 build.
Below is a code snippet you can use for this purpose. You can install as many distributions of Linux as your device will support and use them with your Windows installation. The rest of the article will reference a Ubuntu WSL2 is also faster and more compatible with Linux-native applications or applications that were designed to run only on Linux.
Once your device starts back up, you can start using WSL2 on your existing installed distros.
Below you'll see a few steps to run through to configuring your existing Linux distros for WSL2. Open a PowerShell console and:. From here, you can run any Linux commands you wish. Below you will find a reference to all of the options the wsl. One of the best parts of WSL is that it allows you to seamlessly share Windows and Linux resources with each other.
At this time, you can share file systems, environment variables, network resources and command line interpreters like cmd and PowerShell. Your mileage may vary if you've chosen to download a different distro. The file system is one of the most useful things to share with WSL. WSL allows you to work with both file systems as if they were one.Contents What is WSL?
What is WSL 1? What is WSL 2?
What’s new for WSL in Windows 10 version 1903?
Windows Subsystem for Linux WSL allows users to run a Linux terminal environment, install packages from the Ubuntu archive, and run Linux applications and workflows on Windows No re-compilation or 'porting' of applications is required.
WSL1 provides a Linux-compatible kernel interface developed by Microsoft that allows a user to choose a Linux distribution to install from the Microsoft Store. The WSL1 interface translates Linux system calls from the binaries into Windows system calls and then executes them at native speed. Linux applications run within the Linux distribution which provides the application's dependencies and package management in a container-like environment. WSL2 was announced at Microsoft Build WSL2 features a Linux kernel running inside Windows 10 and is built on the core technology of Hyper-V to provide better Linux application support and improved file performance.
Transitioning to WSL2 is seamless. WSL2 is still in active development and is only available in Insider builds. These builds are not suitable for production devices and are not recommended for a user's primary machine. The following Ubuntu releases are available as apps on the Microsoft Store: Ubuntu It supports the x64 architecture only. Right now it installs Ubuntu Installing a different app in parallel creates a different root file system allowing you to have both Ubuntu LTS releases installed and running in case you need it for keeping compatibility with other external systems.
You can also upgrade your Ubuntu The wsl command on the Windows command prompt or PowerShell By running ubuntu First we check for updates: 1 sudo apt update We use sudo because installing packages is an administrator task and requires elevated privileges. This will not be your Windows password.Applies to Windows 10 Fall Creators Update and later. See our updated installation guide to try new management features and start running multiple Linux distributions from the Microsoft store.
Running a distribution using it's distro-specific application launches that distribution in it's own console window. You can also run the distribution from the command line by running [distribution].
The disadvantage of running a distribution from the command line in this way is that it will automatically change your working directory from the current directory to the distribution's home directory. Not only does wsl keep the current working directory in place, it lets you run a single command along side Windows commands. You can use wsl. Each Linux distribution independently manages its own configurations.
To see distribution-specific commands, run [distro. If a distribution is listed, it's installed and ready to use. They may be in the process of installing, uninstalling, or are in a broken state. The default WSL distribution is the one that runs when you run wsl on a command line. Example: wsl -s Ubuntu would set my default distribution to Ubuntu.
Now when I run wsl npm init it will run in Ubuntu. If I run wsl it will open an Ubuntu session. While Linux distributions can be installed through the Microsoft store, they can't be uninstalled through the store. Caution: Once unregistered, all data, settings, and software associated with that distribution will be permanently lost.
Reinstalling from the store will install a clean copy of the distribution. When I run wsl --list it will not be listed.
Run a specified distribution of WSL, can be used to send commands to a specific distribution without having to change your default. WSL Config wslconfig. It lets you list available distributions, set a default distribution, and uninstall distributions. While WSL Config is helpful for settings that span or coordinate distributions, each Linux distribution independently manages its own configurations.
Automatically configure certain functionality in WSL that will be applied every time you launch the subsystem using wsl. If the file is not there, you can create it yourself. WSL will detect the existence of the file and will read its contents. If the file is missing or malformed that is, improper markup formattingWSL will continue to launch as normal. If the user specifies a gid or uid option explicitly via this key, the associated value will be overwritten.
Otherwise, the default value will always be appended. Note: These options are applied as the mount options for all automatically mounted drives.
Setting different mount options for Windows drives DrvFs can control how file permissions are calculated for Windows files. The following options are available:. Note: The permission masks are put through a logical OR operation before being applied to files or directories. You may also leave feedback directly on GitHub. Skip to main content. Exit focus mode. Launch WSL by distribution Running a distribution using it's distro-specific application launches that distribution in it's own console window.These include accessing the Linux file system from Windows, and improvements to how you manage and configure your distros in the command line.
In the past, creating and changing Linux files from Windows resulted in losing files or corrupting data. Making this possible has been a highly requested and long anticipated feature. The best way to get started with this feature is to open your Linux files in File Explorer!
To do this, open your favorite distro, make sure your current folder is your Linux home directory, and type in:. From here you can access whatever Linux files you would like, just like you would any other file through File explorer. This includes operations such as: dragging files back and forth to other locations, copy and paste, and even interesting scenarios like using the context menu to open VSCode in a WSL directory! This is due to the way Windows accesses the files inside of each distro which you can learn the details of in the following section!
The WSL team is actively investigating ways to improve the discoverability of your Linux files inside of File Explorer. WSL is primarily a command line tool, and so of course this feature also works in the command line.
To put it briefly: a 9P protocol file server facilitates file related requests, with Windows acting as the client. This server contains protocols that support Linux metadata, including permissions. A Windows service and driver that act as the client and talks to the 9P server which is running inside of a WSL instance. This is a new feature, and some pieces of it may not work perfectly.
Here are some known issues that we want to make you aware of when using this feature:. Our team is keen to hear your feedback. In fact WSL itself was created based on our great community feedback! You can now use wsl. You can always check all the commands you can run from wsl. You can now run commands as different users, terminate running distributions, and even export and import different distros! Exporting a distro is accomplished by passing in —export as an argument and will output a tar file of your current distro.
For example, you could use this functionality to share your distro setup with other people. The commands that existed inside of wslconfig. Our goal is to consolidate how you interact with WSL to a single binary. Stay tuned! As always, we want to thank you for providing your feedback and encourage you to keep doing so! Log in to join the discussion.
What does this do, and what is the WslFs format?
The upgrade command will make sure your distro is using a new file system when WSL is accessing your files in your drive. It looks like 9P is now implemented as a network protocol and Explorer. Would it also be possible to mount a remote network share e. I guess the authentification part could be a showstopper but it would be fun to experiment with. Hi Craig, I just discovered this great blog, and have been playing around with wsl on and 20H1 preview builds.
Where would be the best place to find additional information, resources, or someone who might be able to help me sort this out? In the stable versionthis feature also does not work.
Is it just me? Or will it be at 20H1? Accessing Linux files is treated the same as accessing a network resource, and any rules for accessing network resources will still apply e.
I encountered the weirdest bug in WSL right after the automatic update to Windows Its primary goals are to increase file system performance, as well as adding full system call compatibility. WSL 2 uses an entirely new architecture that uses a real Linux kernel. The Linux kernel in WSL 2 is built in house from the latest stable branch, based on the source available at kernel. This kernel has been specially tuned for WSL 2. It has been optimized for size and performance to give an amazing Linux experience on Windows and will be serviced through Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.
Additionally this kernel will be open source. You can find the full source code for the Linux kernel here. WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine VM.
A traditional VM experience can be slow to boot up, is isolated, consumes lots of resources, and requires your time to manage it. WSL 2 does not have these attributes. It will still give the remarkable benefits of WSL 1: High levels of integration between Windows and Linux, extremely fast boot times, small resource footprint, and best of all will require no VM configuration or management.
File intensive operations like git clonenpm installapt updateapt upgradeand more will all be noticeably faster.
Subscribe to RSS
Initial versions of WSL 2 run up to 20x faster compared to WSL 1 when unpacking a zipped tarball, and around x faster when using git clonenpm install and cmake on various projects. Linux binaries use system calls to perform many functions such as accessing files, requesting memory, creating processes, and more. This introduces a whole new set of apps that you can run inside of WSL, such as Docker and more.
Additionally, any updates to the Linux kernel can be immediately ready to be added to your computer, rather than waiting for the WSL team to implement the changes and then have them added. You may also leave feedback directly on GitHub. Skip to main content. Exit focus mode. Brief overview of the WSL 2 architecture WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine VM.
Increased file IO performance File intensive operations like git clonenpm installapt updateapt upgradeand more will all be noticeably faster. Full System Call Compatibility Linux binaries use system calls to perform many functions such as accessing files, requesting memory, creating processes, and more.
Related Articles Is this page helpful? Yes No. Any additional feedback? Skip Submit. Send feedback about This product This page. This page. Submit feedback. There are no open issues. View on GitHub. Is this page helpful?