Export and Import Windows Subsystem for Linux WSL Distro in Windows 10  

    Export and Import Windows Subsystem for Linux WSL Distro in Windows 10

    Export and Import Windows Subsystem for Linux WSL Distro in Windows 10

    How to Export and Import Windows Subsystem for Linux (WSL) Distro in Windows 10
    Published by Category: Apps & Features
    01 Mar 2019
    Designer Media Ltd


    How to Export and Import Windows Subsystem for Linux (WSL) Distro in Windows 10


    The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run native Linux command-line tools directly on Windows, alongside your traditional Windows desktop and modern store apps.

    Starting with Windows 10 build 18342 (19H1) and Windows 10 build 18836 (20H1), Microsoft added some new commands that will give you more functionality when using wsl.exe.

    You can now export and import different WSL 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. Additionally, if you pass in --import as an argument you can import a tar file that contains the root file system of a Linux distro, which allows you to import any distro you’d like (with any configuration you’d like) as a new distro.

    See also: What’s new for WSL in Windows 10 version 1903?

    This tutorial will show you how to export and import Windows Subsystem for Linux (WSL) distros in Windows 10.

    You will need to have Windows Subsystem for Linux (WSL) enabled to be able to export and import WSL distros in Windows 10.


     CONTENTS:

    • Option One: Export Windows Subsystem for Linux (WSL) Distro in Windows 10
    • Option Two: Import Windows Subsystem for Linux (WSL) Distro in Windows 10
    • Option Three: Uninstall Imported Windows Subsystem for Linux (WSL) Distro in Windows 10





    Export and Import Windows Subsystem for Linux WSL Distro in Windows 10 OPTION ONE Export and Import Windows Subsystem for Linux WSL Distro in Windows 10
    Export Windows Subsystem for Linux (WSL) Distro in Windows 10

    1. If you haven't already, you will need to perform the following actions to prepare the WSL distro (ex: Debian) you want to export.

    A) Install the WSL distro (ex: Debian) from the Microsoft Store you want to export.

    B) Open this WSL distro (ex: Debian) to finish installing and setup, make any changes you want, and close the distro.

    C) Check for updates in the Microsoft Store app to make sure this WSL distro (ex: Debian) is fully updated, and close the Microsoft Store app when finished.

    2. Open a command prompt.

    3. Copy and paste the command below into the command prompt, and press Enter. This will give you a list of all currently installed WSL distros for the current user. Make note of the WSL distro name (ex: Debian) you want to export. (see screenshot below)

    wsl --list --all

    Name:  Export_WSL_Linux_distro-1.png
Views: 149
Size:  7.8 KB

    4. Enter the command below into the command prompt, and press Enter. (see screenshot below)

    wsl --export <DistributionName> <Full path to .tar FileName>

    Substitute <DistributionName> in the command above with the actual WSL distro name (ex: "Debian") from step 3 you want to export.

    Substitute <Full path to .tar FileName> in the command above with the full path of the location (ex: "%UserProfile%\Desktop") to where you want to export with the name of the .tar file (ex: "Debian.tar") you want to use.

    For example: wsl --export Debian %UserProfile%\Desktop\Debian.tar


    Name:  Export_WSL_Linux_distro-2.png
Views: 140
Size:  7.3 KB

    5. When finished, you can close the command prompt if you like.

    6. This .tar file (ex: "Debian.tar") is the export of your custom WSL distro used to import with Option Two below.






    Export and Import Windows Subsystem for Linux WSL Distro in Windows 10 OPTION TWO Export and Import Windows Subsystem for Linux WSL Distro in Windows 10
    Import Windows Subsystem for Linux (WSL) Distro in Windows 10

    1. Sign in to the account on the Windows 10 PC you want to import the .tar file (ex: "Debian.tar") from Option One for the WSL distro (ex: Debian) you want.

    2. Open a command prompt.

    3. Copy and paste the command below into the command prompt, and press Enter. This will give you a list of all currently installed WSL distros for the current user. (see screenshot below)

    wsl --list --all

    Name:  Export_WSL_Linux_distro-1.png
Views: 149
Size:  7.8 KB

    4. Enter the command below into the command prompt, and press Enter. (see screenshot below)

    wsl --import <DistributionName> <InstallLocation> <Full path to .tar FileName>

    Substitute <DistributionName> in the command above with the actual WSL distro name (ex: "Debian-Custom") you want to use for this imported WSL distro. This name must be different than any already installed WSL distros listed in step 3.

    Substitute <InstallLocation> in the command above with the full path of the folder (ex: "C:\Data\Debian-Custom") to where you want to install the imported WSL distro.

    Substitute <Full path to .tar FileName> in the command above with the full path of the .tar file (ex: "%UserProfile%\Desktop\Debian.tar") from Option One for the WSL distro you want to import.

    For example: wsl --import Debian-Custom C:\Data\Debian-Custom %UserProfile%\Desktop\Debian.tar


    Click image for larger version. 

Name:	Import_WSL_Linux_distro-1.png 
Views:	13 
Size:	7.7 KB 
ID:	224924

    5. When finished, you can close the command prompt if you like.

    6. Whenever you would like to run the imported WSL distro, type the command below into a command prompt or PowerShell. (see screenshot below)

    wsl --distribution <DistributionName>

    Substitute <DistributionName> in the command above with the actual WSL distro name (ex: "Debian-Custom") you want to run. The wsl --list --all command will give you a list of names for all installed WSL distros for the current account.

    Name:  Import_WSL_Linux_distro-2.png
Views: 140
Size:  9.3 KB






    Export and Import Windows Subsystem for Linux WSL Distro in Windows 10 OPTION THREE Export and Import Windows Subsystem for Linux WSL Distro in Windows 10
    Uninstall Imported Windows Subsystem for Linux (WSL) Distro in Windows 10

    1. Open a command prompt.

    2. Copy and paste the command below into the command prompt, and press Enter. This will give you a list of all currently installed WSL distros for the current user. (see screenshot below)

    wsl --list --all

    Name:  Export_WSL_Linux_distro-1.png
Views: 149
Size:  7.8 KB

    3. Enter the command below into the command prompt, and press Enter. (see screenshot below)

    wsl --unregister <DistributionName>

    Substitute <DistributionName> in the command above with the actual WSL distro name (ex: "Debian-Custom") from step 2 you want to uninstall (unregister).

    For example: wsl --unregister Debian-Custom


    Name:  Uninstall_WSL_distro.png
Views: 132
Size:  7.0 KB

    4. When finished, you can close the command prompt if you like.


    That's it,
    Shawn


    Related Tutorials



  1. johngalt's Avatar
    Posts : 1,714
    WinX Pro x64 IP current
       #1

    I'm assuming that Option 2 only works with exported distros from Option 1, correct?

    Thanks for this (and all the related ones) that you put up today!
      My ComputersSystem Spec

  2. Brink's Avatar
    Posts : 36,975
    64-bit Windows 10 Pro build 18860
    Thread Starter
       #2

    johngalt said: View Post
    I'm assuming that Option 2 only works with exported distros from Option 1, correct?

    Thanks for this (and all the related ones) that you put up today!

    Hello John,

    That would be correct. Option 2 would need any exported .tar from Option 1.
      My ComputersSystem Spec

  3. johngalt's Avatar
    Posts : 1,714
    WinX Pro x64 IP current
       #3

    Bummer.

    Wish WSL would allow users to import their own distros....
      My ComputersSystem Spec

  4. Brink's Avatar
    Posts : 36,975
    64-bit Windows 10 Pro build 18860
    Thread Starter
       #4

    johngalt said: View Post
    Bummer.

    Wish WSL would allow users to import their own distros....

    If it's a .tar file, you could give it a try.
      My ComputersSystem Spec

  5. johngalt's Avatar
    Posts : 1,714
    WinX Pro x64 IP current
       #5

    Actually, I just found this:

    Build a Custom Linux Distro for WSL | Microsoft Docs

    Time to play a bit.
      My ComputersSystem Spec


 

Tutorial Categories

Export and Import Windows Subsystem for Linux WSL Distro in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


Related Threads
Source: Using WSL in an Enterprise Windows Command Line Tools For Developers
Source: Open Sourcing a WSL Sample for Linux Distribution Maintainers and Sideloading Custom Linux Distributions Windows Command Line Tools For Developers
Source: Windows Subsystem for Linux out of Beta! Windows Command Line Tools For Developers Enable or Disable Bash on Ubuntu in Windows 10
I watched a video about the guy using Windows subsystem and run full Linux desktop without using remote software. There is no white thing on top. He can switch between Linux and Windows using a keyboard shortcut. Linux desktop is smooth, 60 fps, no...
Read more: Fun with the Windows Subsystem for Linux | Building Apps for Windows

Tags for this Thread

Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:49.
Find Us