On Linux, the Wine settings are kept in the ~/.wine folder. In this folder, any Windows programs you install on Linux, drivers, utilities and everything else is accessible here, so it’s a good idea to learn how to make a backup of this directory. Creating a back up of Wine settings can be done in a few different ways. In this post, I’ll be talking about a couple of ways to go about it.
Back up Wine settings with cp
Did you know that you don’t have to compress and use a special backup tool to make a complete backup of Wine on Linux? It’s true! As it turns out, you need to make a full copy of the folder where all of your Wine applications and settings go!
The quickest and easiest way to create a fast back up of Wine settings is to make use of the cp (copy) command. Here’s how it works. To start, launch a terminal window and press Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the ls command to reveal the hidden wine folder in /home/.
Locate the ~/.wine folder. Then, rerun ls, on that folder to ensure that it’s empty, and your data is in it.
Look at the print-out on screen and confirm everything is where it should be. After that, use the cp command (with the r switch) to make a complete copy of this directory. Be sure to change the second half of the command to the location where you’d like to make a complete copy of your Wine data (like the ~/Documents folder, for example).
cp -r ~/.wine ~/Documents/wine-backup/
Running the cp command above is going to take a very long time, especially if you have some large Windows’ programs or video games on there. Just be patient, and let the copy command run through. When it’s done, open up your file manager to /home/Documents/ and copy the “wine-backup” directory to an external hard drive, USB, etc.
Restore the backup
Need to restore your backup of the Wine folder on your Linux PC? Here’s what to do. First, copy the “wine-backup” folder from wherever you are keeping it back to /home/Documents/. Then, use the cp command to make a full copy of the home folder, restoring the backup.
cp -r ~/Documents/wine-backup/ ~/.wine
Like before, please understand that the restoration process will take quite a long time. Sit and wait, and soon your Wine files and folders will be back where they should be.
Back up Wine settings with Tar
The cp command can quickly make a copy of a folder for the user to place somewhere else. Sadly, this backup method only works for local files, and if you want to keep your Wine backup on the internet, it won’t help you at all.
A great alternative to the cp method is to take your Wine folder and create a TarGZ archive. Then, after it’s in the TarGZ file, it’ll be easy to upload to services like Dropbox, a P2P syncing tool like SyncThing. It even makes it possible to encrypt the backup!
To start the backup process, launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, use the tar command to compress your ~/.wine directory into a TarGZ file.
Compressing the entire Wine directory isn’t a speedy process. It will take up to 45 minutes at the very least. The time it takes is expected, as most people looking to make a back up of their Wine files have more than a couple of programs and even some games in there as well.
When the compression is done, you will see a sizeable TarGZ file in your home directory (~/) with the label of “
Have sensitive files in your Wine TarGZ backup you don’t want anyone to have access to? If so, consider using the GPG tool to encrypt it.
To start the encryption, launch a terminal and use the GPG tool to encrypt your backup.
Note: don’t have GPG installed? Click here for more information.
gpg -c wine-folder-backup.tar.gz
When GPG is done encrypting, take wine-folder-backup.tar.gz.gpg and put it in a safe place.
To start the restoration process, take the “wine-folder-backup.tar.gz” file and place it on your PC into the “Documents” folder.
Note: if you have to decrypt your backup first, run gpg wine-folder-backup.tar.gz.gpg.
Use the CD command to move the terminal where the TarGZ backup file is.
Next, delete the old “Wine” folder, to ensure that the tar command doesn’t run into any issues.
rm -rf ~/.wine
Finally, restore the backup to the home folder by running:
tar -xzvf wine-folder-backup.tar.gz -C ~/ --strip-components=2