Windows 10 now lets you export installed Linux environments, creating a TAR file of the root file system you can import on other PCs. Copy your configured systems between computers, share them with others, or just save a backup.

How This Works

The import and export features were added in the May 2019 Update—that’s Windows 10 version 1903. If you don’t have it installed yet, you won’t be able to use these command-line options.

All you need are two new options for the Windows wsl command: --export and --import . The --export option will export a Linux distribution’s root file system as a TAR file. The --import option lets you import a Linux distribution’s root file system as a TAR file.

RELATED: How to Install and Use the Linux Bash Shell on Windows 10

How to Export (Back Up) a Linux System

The wsl command is a Windows command—wsl.exe. You’ll need to run it in a PowerShell or Command Prompt environment, not in a Windows Subsystem for Linux environment. You can open one by right-clicking the Start button or pressing Windows+x and then clicking “Windows PowerShell.”

To list the distros installed, run the following command:

wsl --list

Now, use the following command to export a distro’s file system to a TAR file:

wsl --export distro_name file_name.tar

For example, to export out Ubuntu 18.04 system to a file named ubuntu.tar, we’d run:

wsl --export Ubuntu-18.04 ubuntu.tar

You now have a TAR file containing the Linux distribution’s file system. The file we created—based on a pretty standard Ubuntu 18.04 LTS system—was 645 MB in size. If you’ve installed more software in your distribution, it will be larger.

How to Import (Restore) a Linux System

You can use the wsl command with the --import option to import a TAR file created in this way. From a PowerShell or Command Prompt window, run the following command

wsl --import distro_name install_location file_name.tar

For example, let’s say you want to import a distro from a TAR file located at C:\Users\Chris\ubuntu.tar, call it “Ubuntu-18.04,” and store it at C:\Users\Chris\ubuntu. You’d run:

wsl --import Ubuntu-18.04 C:\Users\Chris\ubuntu C:\Users\Chris\ubuntu.tar

If you want to match where Windows normally installs them to by default, they’re generally in their own folder in C:\Users\NAME\AppData\Local\Packages. For example, you might want to put Ubuntu in C:\Users\NAME\AppData\Local\Packages\Ubuntu.

Wherever you put the install location, note that you shouldn’t modify the files directly from Windows tools. Here’s how you should access the files in File Explorer instead.

How to Unregister (Delete) a Linux System

You can uninstall a distro with the --unregister option along with its name. This will result in all the Linux distribution’s files being deleted.

Use the following command to see all installed distributions:

wsl --list

Then, specify the distribution you want to delete:

wsl --unregister distro_name

For example, if it’s called Ubuntu-18.04, you’d run:

wsl --unregister Ubuntu-18.04

This feature also lets you quickly and easily move installed distributions to another folder or drive. Just export the distro to a TAR file, unregister it from your system, and then import the TAR file to another location on your system.