Last update: February 9, 2024.
Sometimes it’s not bad to be able to save the current state of your current WSL distribution and reload it later. Saving is called export, reloading is called import. Yet both are easy to do.
Before exporting, you need to know what you can export, so it’s a good idea to list existing distributions.
> wsl --list
The standard syntax for exporting is: wsl –export <Distribution Name> <File Name> For example, if you have a distribution called Ubuntu and you want to export it as x:\WSL\Ubuntu.tar, you should export it as follows. . :
> wsl --export DistroName PathtoSavedContainers\ContainerName.tar
You can reload it later with the wsl import command. The syntax is wsl –import <Distribution Name> <Installation Location> <File Name> For example, you can reload a previously exported Ubuntu distribution as follows:
> wsl --import DesiredDistroName PathtoWSLImages PathtoSavedContainers\ContainerName.tar
After importing you must close and open again the Command app. Then open the imported distro, su to your user and change to your home directory like this:
># su UserName
>#cd ~UserName
That’s all for now.