How to import and export WSL distros on Windows 10

With Windows 10, Microsoft allows a user to run multiple Linux distros based on WSL or Windows Subsystem for Linux. But when reinstalling or resetting Windows 10, all the configuration stored with these WSL distros gets deleted. Or to back up and restore this configuration, it becomes challenging for the user to do so. But Microsoft has got it covered. Users can import and export these WSL or Windows Subsystem for Linux distros. In this article, we will be checking out how to do it using the export or import arguments.

How to import and export WSL distros on Windows 10

Import & export WSL distros on Windows 10

We will be looking at three aspects that deal with import and export of WSL distros on Windows 10. They are as follows:

  1. Import WSL distro.
  2. Export WSL distro.
  3. Uninstall imported WSL distros.

You need to have all your installed distros to be up to date via the Microsoft Store.

1] Import WSL distro

import and export WSL

Open the Command Prompt with Admin level rights. Execute the following command in Command Prompt:

wsl --list --all

It will list all the install WSL Distros on your computer.

To import a WSL distro, execute the following command in Command Prompt:

wsl --import <Name of the distro> <Fill path to save the backup .tar file>

import and export WSL

For example: wsl –import Ubuntu-18.04 C:\Users\Ayush\Desktop\Ubuntu1804Backup.tar

The command will restore the backup to the given WSL Distro.

2] Export WSL distro

import and export WSL

Open Windows Command Prompt with Administrator permissions. Execute the following command in CMD:

wsl --list --all

It will list all the install WSL Distros on your computer.

To export a WSL distro, execute the following command in Command Prompt:

wsl --export <Name of the distro> <Fill path to save the backup .tar file>

For example: wsl –export Ubuntu-18.04 C:\Users\Ayush\Desktop\Ubuntu1804Backup.tar

After that, you imported backup will be found in the location you entered in the command.

3] Uninstall imported WSL distros

Open CMD with Administrator permissions. Execute the following command:

wsl --list --all

Next, execute the following command to uninstall the imported WSL distros:

wsl --unregister <Name of the distro>

Once the process completes, close the Command Prompt.

I hope this guide is useful.

Posted by on , in Category Windows with Tags
Ayush has been a Windows enthusiast since the day he got his first PC with Windows 98SE. He is an active Windows Insider since Day 1 and is now a Windows Insider MVP. He has been testing pre-release services on his Windows 10 PC, Lumia, and Android devices.