قالب وردپرس درنا توس
Home / Tips and Tricks / How To Export And Import Your Linux Systems On Windows 10

How To Export And Import Your Linux Systems On Windows 10



  Linux Tux Penguin on the desktop background of Windows 10
Larry Ewing

With Windows 1

0, you can now export installed Linux environments and create a TAR file of the root file system that you have on others Can import PCs. Copy your configured systems between computers, share them with others, or just save a backup copy.

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 wsl : - 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 [19659009] Exporting (Backing Up) a Linux System

The command 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.

Run the following command to list the installed distributions:

  wsl --list 

Now, use the following command to export the file system of a distribution to a tar file:

  wsl --export distro_name file_name.tar 

For example, to export the Ubuntu 18.04 system to a file named ubuntu.tar, we would do the following:

  wsl --export Ubuntu-18.04 ubuntu.tar [19659012]  Exporting a WSL Environment to PowerShell  

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.

 TAR file of a Linux environment created by Windows 10

Importing (restoring) a Linux system

Use the 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.

 Importing a Linux TAR file into PowerShell

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:

  wsl --list 

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 

 Unregister or delete a Linux environment from the Windows 10 command line

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.




Source link