Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Friday, April 10, 2020

Access your Linux files from File Explorer (Build 19603)

Windows users with WSL (Windows Subsystem for Linux) installed, already had the ability to access their Linux files. With Windows 10 Insider Preview Build 19603, it has been much more easier.
Build 19603 now exposes a "Linux" node in File Explorer so that you can access your installed WSL distros file system.
Now there's File Explorer integration in the WSL. Now you can access Linux files from your left-hand navigation pan in File Explorer. One can see the Linux Tux icon in the File Explorer.

Selecting the Linux icon will provide a view of all your distros and selecting those will place you in the Linux root file system for that distro.


Saturday, June 22, 2019

How to install WSL 2?

In the previous post we learnt a bit about WSL 2. Now follow the below given steps to install WSL 2.
Ensure that you have WSL installed and that you are running Windows 10 build 18917 or higher. 


        Enable the 'Virtual Machine Platform' optional component and make sure WSL is enabled
    • Make sure that you have both the Windows Subsystem for Linux and the Virtual Machine Platform optional components installed. You can do that by running the following command in PowerShell:
    •  dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
      dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
     Restart your machine to finish installing both components

    Set a distro to be backed by WSL 2 using the command line: 

     To set a distro please run:

    wsl --set-version <Distro> 2

    Replace <Distro> with the actual name of your distro. (You can find these with the command: wsl -l). You can change back to WSL 1 at anytime by running the same command as above but replacing the '2' with a '1'.

    Additionally, if you want to make WSL 2 your default architecture you can do so with this command:
    wsl --set-default-version 2

    This will make any new distro that you install be initialized as a WSL 2 distro.

    (If you do not have a Linux distro installed, please refer to the Install on Windows 10 docs page for instructions on installing one.)

    Finish with verifying what versions of WSL your distro are using
    To verify what versions of WSL each distro is using use the following command
    wsl --list --verbose or wsl -l -v

    The distro that you've chosen above should now display a '2' under the 'version' column. Now that you're finished feel free to start using your WSL 2 distro!

     Please note WSL 2 is only available in Windows 10 builds 18917 or higher.
  • (source: Microsoft Docs
Update: watch this video  to see how to install WSL 2.

Saturday, June 15, 2019

WSL 2

WSL 2 is a new version of the architecture in WSL that changes how Linux distros interact with Windows. WSL 2 is a major overhaul of the underlying architecture and uses virtualization technology and a Linux kernel to enable its new features. WSL 2 aims at increasing file system performance and adding full system call compatibility. Each Linux distro can run as a WSL 1, or a WSL 2 distro and can be switched between at any time. Individual Linux distros can be upgraded or downgraded at any time, and you can run WSL 1 and WSL 2 distros side by side.

The Linux kernel in WSL 2 is built in-house from the latest stable branch and is 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.

File intensive operations will be noticeably faster. Initial versions of WSL 2 run up to 20x faster compared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using git clone, npm install and cmake on various projects.

Some FAQs on WSL 2 : 
Will it be available on Windows 10 Home?
WSL 2 will be available on all SKUs where WSL is currently available, including Windows 10 Home.

Does WSL 2 use Hyper-V?
The newest version of WSL uses Hyper-V architecture to enable its virtualization. This architecture will be available in the 'Virtual Machine Platform' optional component. 

What will happen to WSL 1?
Currently there are no plans to deprecate WSL 1. You can run WSL 1 and WSL 2 distros side by side, and can upgrade and downgrade any distro at any time. 

Can I run WSL 2 in a virtual machine?
Yes! You need to make sure that the virtual machine has nested virtualization enabled. This can be enabled in your parent Hyper-V host by running the following command in a PowerShell window with Administrator privileges:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
Make sure to replace '<VMName>' with the name of your virtual machine.

Check the source for more details and many more FAQs.
In our next post we will see how to install WSL 2.

(Source: Microsoft Docs)

Sunday, February 24, 2019

Access Linux files from Windows

Windows 10 Insider Preview Build 18342 has been released recently and many new features have been added with it. Among them is one of the most requested feature of accessing all the files in your Linux distros from Windows.
Earlier creating, changing Linux files from Windows resulted in losing or corrupting of files. Now this has been made possible to access Linux files from Windows without corruption. These files can be accessed through the command line, and also Windows apps, like File Explorer, VSCode, etc. can interact with these files.Access your files by navigating to \\wsl$\<distro_name>, or see a list of running distributions by navigating to \\wsl$.
Just for info: Why is the WSL resource name in the filepath called wsl$?
“Since wsl is a short acronym we realize that some resources on networks may already have that name. So we’ve added a dollar sign, since a machine name can’t have a dollar sign in it, which ensures that the name will be accessible with any existing network configuration.”
Accessing via File Explorer:
Try opening your Linux files in Explorer. To do this, open your favorite distro, ensure your current folder is your Linux home directory and type in explorer.exe . This will open a File Explorer window, located inside of your Linux distro.

So from here, you can access whatever Linux files you want, just like you do for any other file through File explorer. You can also do operations like dragging files back & forth to other locations, can copy and paste. One can also even use the context menu.

When using this feature as said above, you’ll notice the distro files are exposed through the path: \\wsl$\<running_distro_name>\. This is due to the way Windows accesses the files inside of each distro. This will be improved by the WSL team.
Accessing via Command line:
WSL is primarily a command line tool, and so of course this feature also works in the command line. You can find your distro’s files by accessing \\wsl$\{distro name}\ where {distro name} is the name of a running distro.

Here Debian is accessed with PowerShell
Since its a new feature, there might be some issues. Some of these known issues are:
  • As of now, the distros files will only be accessible from Windows when the distro is running. In future non-running distros too will be supported.
  • Accessing Linux files is treated the same as accessing a network resource, and any rules for accessing network resources will still apply
    e.g: When using CMD, cd \\wsl$\Ubuntu\home will not work (as CMD does not support UNC paths as current directories), however copy \\wsl$\Ubuntu\home\somefile.txt C:\dev\ will work
  • You should NOT access your Linux files inside of the AppData folder!
    If you try to access your Linux files through your AppData folder, you are bypassing using the 9P server, which means that you will not have access to your Linux files, and you could possibly corrupt your Linux distro.
For more details check source.