Forrest logo
back to the wsl tool

wsl:tldr:f2df8

wsl: Export a distribution to a `.tar` file.
$ wsl --export ${distribution} ${path\to\distro_file-tar}
try on your machine

The command "wsl --export ${distribution} ${path\to\distro_file-tar}" is used to export a WSL (Windows Subsystem for Linux) distribution to a tar file. Let's break down the command:

  • "wsl": It is a command-line tool used to manage and interact with WSL distributions on Windows.
  • "--export": This flag specifies that the following distribution should be exported.
  • "${distribution}": It is a placeholder for the name of the WSL distribution that you want to export. You need to replace this placeholder with the actual distribution name.
  • "${path\to\distro_file-tar}": It is a placeholder for the desired file path and name of the resulting tar file that will contain the exported WSL distribution. You need to replace this placeholder with the actual file path and name.

For example, if you have a WSL distribution named "Ubuntu-20.04", and you want to export it to a tar file named "ubuntu.tar" located in the "C:\exports" directory, you would use the following command:

wsl --export Ubuntu-20.04 C:\exports\ubuntu.tar

This command will create a tar file containing the entire WSL distribution, including its file system and configurations, at the specified location.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the wsl tool