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
OPTION ONE
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

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

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.
OPTION TWO
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

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

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.

OPTION THREE
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

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

4. When finished, you can close the command prompt if you like.
That's it,
Shawn