With Windows 1
How it Works
The import and export features have been added in the May 2019 update. If it is not already installed, you can not use these command-line options.
You only need two new options for the Windows command
- export and
- Import . The option
- Export exports the root file system of a Linux distribution as a tar file. With the option
- Import you can import the root file system of a Linux distribution as a tar file.
RELATED: Installing and Using the Linux Bash Shell on Windows 10  Exporting (Backing Up) a Linux System
The command Run the following command to list the installed distributions: Now, use the following command to export the file system of a distribution to a tar file: For example, to export the Ubuntu 18.04 system to a file named ubuntu.tar, we would do the following:
wsl is a Windows command – wsl.exe. You must 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.
wsl --export distro_name file_name.tar
wsl --export Ubuntu-18.04 ubuntu.tar 
Run the following command to list the installed distributions:
Now, use the following command to export the file system of a distribution to a tar file:
For example, to export the Ubuntu 18.04 system to a file named ubuntu.tar, we would do the following:
You now have a TAR file containing the file system of the Linux distribution. The file we created - based on a fairly standard Ubuntu 18.04 LTS system - was 645 MB in size. If you have more software installed in your distribution, it will be bigger.
Importing (restoring) a Linux system
command wsl with the option
- import to import a TAR file created in this way. Run the following command in a PowerShell or Command Prompt window
wsl --import distro_name install_location file_name.tar
For example, suppose you want to import a distribution from a TAR file into C: Users Chris ubuntu.tar , call it "Ubuntu-18.04" and save it under C: Users Chris ubuntu. You would run:
wsl --import Ubuntu-18.04 C: users Chris ubuntu C: users Chris ubuntu.tar
If you want to specify where Windows normally installs them by default, you are usually in a separate folder under C: Users NAME AppData Local Packages. You may want to put Ubuntu in C: Users NAME AppData Local Packages Ubuntu.
Note that you should not change the files directly in the Windows tools wherever you specify the installation location. Instead, do the following to access the files in File Explorer.
Unregistering (deleting) a Linux system
You can uninstall a distribution with
. --unregister Option along with its name. This causes all files of the Linux distribution to be deleted.
Use the following command to view all installed distributions:
Then specify the distribution to delete:
wsl - -unregister distro_name
For example, if you have Ubuntu 18.04 means you would do the following:
wsl --unregister Ubuntu-18.04
Use this feature to enable Quickly and easily move installed distributions to another folder or to another drive. Simply export the distribution to a TAR file, remove the registry from your system, and import the TAR file to another location on your system.