Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Save Linux Desktop Settings (Backup Guide)

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can back up your Linux desktop settings so that if something goes wrong (a bad update, a broken extension, or a failed tweak), you can restore your layout, themes, and app preferences. The exact files to copy depend on your desktop environment, but the general method is the same: copy your configuration folders from your home directory to a safe location, and restore them when needed. This guide covers the most common desktop environments (GNOME, KDE Plasma, XFCE, and Cinnamon) and works on most distributions.

What You'll Need

  • A Linux desktop with a standard home directory (most distributions).
  • Access to a terminal (or a file manager with "show hidden files" enabled).
  • An external drive, USB stick, or cloud storage to store the backup (so it survives a system failure).
  • Optional: a text editor to edit a simple backup script.

Step-by-Step

  1. Identify your desktop environment. If you are not sure, run this command in a terminal: echo $XDG_CURRENT_DESKTOP. It will print something like GNOME, KDE, XFCE, or X-Cinnamon. This tells you which folders to back up.
  2. Close all running applications. Some apps write settings only when they exit, so closing them ensures the backup captures the latest state.
  3. Open a terminal. You can use the file manager, but the terminal makes it easier to copy hidden folders.
  4. Create a backup directory. For example: mkdir ~/desktop-backup-$(date +%Y%m%d). This creates a folder with today's date.
  5. Copy your desktop environment's configuration folders. The folders are hidden (they start with a dot). Use the following commands for your environment:
    • GNOME: cp -r ~/.config/gnome-shell ~/.config/nautilus ~/.config/gtk-3.0 ~/.config/gtk-4.0 ~/desktop-backup-*/ (also copy ~/.local/share/gnome-shell for extensions).
    • KDE Plasma: cp -r ~/.config/plasma-org.kde.plasma.desktop-appletsrc ~/.config/kdeglobals ~/.config/breezerc ~/.local/share/plasma ~/desktop-backup-*/ (the entire ~/.kde or ~/.kde4 folder on older versions).
    • XFCE: cp -r ~/.config/xfce4 ~/.config/xfce4-session ~/desktop-backup-*/.
    • Cinnamon: cp -r ~/.cinnamon ~/.config/cinnamon ~/desktop-backup-*/.
    If you are not sure which folders matter, the safest approach is to copy the entire ~/.config folder and the ~/.local/share folder (but note that these can be large). For most desktops, copying ~/.config alone captures most settings.
  6. Also back up your application settings. Many apps store their preferences in ~/.config (for example, ~/.config/Code for VS Code, ~/.config/google-chrome for Chrome). If you want to restore app-specific settings, include those folders as well. A simple way is to copy the entire ~/.config folder: cp -r ~/.config ~/desktop-backup-*/.
  7. Copy any desktop-specific data. For GNOME, also copy ~/.local/share/gnome-shell (extensions) and ~/.local/share/nautilus (file manager scripts). For KDE, copy ~/.local/share/konsole if you use custom profiles.
  8. Verify the backup. Run ls -la ~/desktop-backup-* to see the copied folders. Make sure the sizes look reasonable (a few MB to a few hundred MB, depending on how many apps you have).
  9. Move the backup to an external drive. For example: cp -r ~/desktop-backup-* /media/your-user/YourUSB/. Replace the path with your actual mount point. If you use cloud storage, upload the folder there.
  10. Test the restore (optional but recommended). Before you need it, try restoring to a test user account or a virtual machine. This confirms your backup is complete.

Common Mistakes

  • Not closing applications first. If an app is still running, it may overwrite the settings file after you copy it, so your backup is stale.
  • Only copying the visible folders. Desktop settings are almost always in hidden folders (starting with a dot). You must enable "show hidden files" or use the terminal.
  • Forgetting to back up the entire ~/.config folder. Some apps store settings there, and if you only copy the desktop-specific folders, you lose those.
  • Storing the backup only on the same disk. If the disk fails, the backup is gone. Always use an external drive or cloud storage.
  • Not testing the restore. A backup you never restore is just a guess. Test it on a spare user account.

Tips

  • Use a simple script. Instead of typing the copy commands every time, create a script file (e.g., backup-desktop.sh) with the commands above, make it executable with chmod +x backup-desktop.sh, and run it whenever you want a fresh backup.
  • Keep multiple backups. Keep at least two recent backups (e.g., one from last week and one from today). If a setting gets corrupted gradually, you can go back to an older version.
  • Use a version control system like Git. If you are comfortable with the terminal, you can initialize a Git repository in your ~/.config folder and commit changes regularly. This lets you see what changed and revert individual files.
  • Know where your desktop stores the wallpaper and themes. These are often in ~/.local/share/backgrounds and ~/.themes (or /usr/share/themes for system-wide themes, which you usually don't need to back up).

Troubleshooting

If your backup does not restore correctly, try these steps in order:

  1. Check that you copied the right folders. Compare the folder names in your backup with the ones in your home directory. A typo in the folder name is a common issue.
  2. Log out and log back in. Some settings (like panel layout) only reload when you start a new session. If you restored while logged in, log out and back in to force a reload.
  3. Restart the desktop shell. For GNOME, press Alt+F2, type r, and press Enter. For KDE, you can run kwin_x11 --replace or kwin_wayland --replace in a terminal (depending on your session).
  4. If nothing works, restore the entire ~/.config folder. Sometimes a setting is stored in a file you didn't copy. Replace the whole folder, but be aware this will reset any app settings you changed after the backup.
  5. If the desktop is completely broken, boot from a live USB. Mount your system drive, copy the backup from your external drive to the correct location, and reboot. This works because the backup is just files.

Frequently Asked Questions

Do I need to back up system-wide settings in /etc?

No, for desktop settings you only need your user configuration. System-wide settings (like display manager configuration) are separate and usually not needed for a desktop restore.

Can I just copy my entire home folder?

Yes, that will work, but it includes documents, downloads, and other data, making the backup much larger and slower. It's better to copy only the configuration folders unless you also want a full data backup.

Will this backup my browser bookmarks and passwords?

Browser bookmarks and passwords are stored in your profile folder (e.g., ~/.config/google-chrome or ~/.mozilla/firefox). If you copy those folders, yes. But passwords are often encrypted and may not transfer to a different system without the original keyring. It's safer to use the browser's built-in sync.

What if I use a different desktop environment than the ones listed?

The general principle is the same: copy the hidden configuration folders in your home directory. For less common desktops (like LXQt or MATE), look for folders like ~/.config/lxqt or ~/.config/mate. You can also copy the entire ~/.config folder to be safe.

How often should I back up?

Every time you make a significant change to your desktop (new theme, new extensions, reordering panels), or at least once a month. It takes less than a minute with a script.

Can I restore settings to a different Linux distribution?

Usually yes, as long as the desktop environment is the same or similar. For example, GNOME settings from Ubuntu usually work on Fedora's GNOME. However, some app-specific settings may reference paths that don't exist, so expect minor glitches.