1. Home
  2. Linux

How To Back Up The LXDE Desktop Settings On Linux

Customizing a desktop environment on Linux is fun and rewarding but time-consuming. Rather than spending an entire day re-setting up your LXDE desktop environment each time you install it, you shold back up the LXDE desktop settings, and restore from it whenever you need to.

SPOILER ALERT: Scroll down and watch the video tutorial at the end of this article.

Back Up LXDE Settings

LXDE is still a popular desktop environment, despite its age. Due to the age of it, you won’t be able to do a quick backup by exporting things in Dconf. Instead, if you want to preserve your LXDE desktop environment, you’ll need to create a complete backup of the ~/.config folder.

Making a backup of ~/.config is best done with a TarGZ archive. With these types of archives, users can easily preserve all of the file permissions in the backup. While safeguarding permissions for configuration files isn’t ultimately that important, it’s still a reasonable precaution to take.

Open up a terminal and use the tar command to create a new TarGZ archive.

tar -cvpf my-configuration-folder.tar.gz ~/.config

Encrypt Backups

Creating a GPG encryption of a desktop environment, for the most part, isn’t required. However, in this tutorial it is since we are building a complete backup of the entire ~/.config folder (which has your browser profile, and other application login settings) rather than just a few LXDE folders.

Before attempting to make a complete GPG backup, you’ll need to ensure that you have GnuPG on your Linux PC. Open up a terminal and follow the instructions that correspond with your operating system.

Ubuntu

sudo apt install gpg

Debian

sudo apt-get install gpg

Arch Linux

sudo pacman -S gnupg

Fedora

sudo dnf install gpg

OpenSUSE

sudo zypper install gpg

Generic Linux

Need to install GPG on your Linux PC but unsure of how to do it? Open up a terminal window, search the package manager for “gpg” and install it. Alternatively, find a downloadable binary package from Pkgs.org.

Start the encryption process by executing the gpg command along with the “c” switch.

gpg -c my-configuration-folder.tar.gz

Fill out the password prompt that appears in your terminal to finish the encryption process. Don’t forget to use a secure password! When the encryption is complete, you’ll see my-configuration-folder.tar.gz.gpg in your home directory. Feel free to upload this file to the cloud or a home server for safe keeping.

After uploading the backup to a safe place, use the rm command to delete the unencrypted TarGZ archive.

rm my-configuration-folder.tar.gz

Themes And Icons

The LXDE desktop environment configuration settings are safe and secure in a GPG encrypted archive. However, the LXDE backup process isn’t complete, as we still need to create a copy of your custom icons and and themes.

Creating a backup of custom icons and themes on Linux involves compressing  ~/.icons and ~/.themes folders into separate TarGZ archives. Start the backup process by opening up a terminal and running the following commands.

Note: did you install icons and themes system-wide? If so, create a back up of  /usr/share/icons/ and /usr/share/themes/ directories, and not ~/.icons and ~/.themes.

tar -cvpf custom-icons.tar.gz ~/.icons

tar -cvpf custom-themes.tar.gz ~/.themes

For system-wide icons and themes, do the following.

sudo -s

cd /usr/share/

tar -cvpf custom-icons.tar.gz icons

tar -cvpf custom-themes.tar.gz themes

mv *.tar.gz /home/username/

Now that all custom themes and icons are in TarGZ archives, the backup is complete. Move these TarGZ files to the cloud, or a home server for safe keeping.

Restore Backup

Download your my-configuration-folder.tar.gz.gpg file and place it in the ~/Downloads folder. Do the same for the custom-icons.tar.gz and custom-themes.tar.gz files. When all of the files are in place, open up a terminal window and use the CD command to navigate to the ~/Downloads folder.

cd ~/Downloads

In ~/Downloads, use the gpg command to decrypt your my-configuration-folder.tar.gz.gpg file.

gpg my-configuration-folder.tar.gz.gpg

Once decrypted, restore the file to your home directory with the tar command.

tar --extract --file my-configuration-folder.tar.gz -C ~/ --strip-components=2

After restoring your configuration files, extract both the icon and theme archive files with tar.

Restore icons and themes for a single user

tar --extract --file custom-icons.tar.gz -C ~/ --strip-components=2

tar --extract --file custom-themes.tar.gz -C ~/ --strip-components=2

Restore icons and themes system-wide

sudo tar --extract --file custom-icons.tar.gz -C /usr/share/ --strip-components=1 --overwrite 

sudo tar --extract --file custom-themes.tar.gz -C /usr/share/ --strip-components=1 --overwrite

When the icons are in place, your LXDE desktop you will need to reboot your Linux PC. This is because the LXDE desktop environment can’t automatically apply changes to the settings.

After restarting, log back into LXDE and everything should look as it did before creating your backup!

Leave a comment