How to: Backup and Migrate your Linux Configuration Files

Avatar

One great fact about Linux applications is their ability to store their settings in hidden folders inside home folders of every user account. As a result, the backup and restore operations become very easy, compared with the ones in Windows, because the settings of their apps are stored in various system folders and in registry.

Therefore, if you want to back up your settings, so you can then move to a new Linux distribution or other computer and take them with you, there is an easy method to create such copies. Let’s see how you can do it.

View your User’s Account Configuration Files

  • First of all, you should set up your user account’s configuration files. Open your distribution’s file manager and go to your home folder.
  • Then, enable the Show Hidden Files option in your Linux desktop’s file manager.

For instance, if you open the Nautilus file manager, you will automatically go to your home folder. There, you can click on the View menu and choose Show Hidden Files.

Screenshot - 8_8_2014 , 1_04_35 πμ

  • Once you’ve selected Show Hidden Files, you will see a lot of files and folders. If you notice, all of their names begin with a period.
  • If you want to hide all those files and folders, all you have to do is rename them so they will start with the ”a.”character. Your File manager will automatically hide them, so they won’t disturb you anymore.

Screenshot - 8_8_2014 , 1_04_35 πμ

 

Find the Settings Folder of an Application

  • You will usually find many folders of your apps under the home directory. However, some of them are also located under the .config folder. If you navigate through the system you will find the configuration files of the app , which you want to back up, are stored.
  • For instance, GNOME apps either use the Gconf or the Dconf systems to store their settings. The Gconf settings can be found in .gconf and the Dconf settings are located in .config/dconf. Copy all files and app settings, found in Gconf and Dconf, so that they will be available in your new computer.
  • The migration of a specific app’s settings from Gconf or Dconf can be done by either using the gconfool or the dconf commands. You can use these commands to store parts of Gconf or Dconf to a file and the restore them in your new PC.

Screenshot - 8_8_2014 , 1_04_35 πμ

Backup and Restore an App’s Settings

  • If you want to back up an application’s settings, you should first copy its configuration folder to a removable storage device, such as a USB drive and external hard drive, or in a cloud storage folder.
  • Alternatively, you can right-click on a folder in your file manager and create an archive file. It’s easier to move such a file.
  • Make sure that you have closed the app, of which you back up its configuration files. This action can confirm that the app has ended and saved its settings. As a result, you will have a clean settings folder available in your new Linux.

Screenshot - 8_8_2014 , 1_04_35 πμ

  •  Put the folder of an application in your user’s account home folder, so you can restore its settings in your new Linux distribution. This is a handy solution, when you reinstall your Linux and you want to keep the settings of an important app as they were.
  • For your safety, delete or rename the configuration files that already exist, right before you migrate the old ones. For instance, if you want to migrate your Firefox settings to another Linux distribution, you should first delete the .mozilla directory from that distribution, before migrating your old .mozilla folder. This action will ensure that you do not have various files from two different configuration files simultaneously.

Screenshot - 8_8_2014 , 1_04_35 πμ

  • In case you want to delete the settings of a Linux app, go to your home folder and view hidden files. Then, locate the app’s configuration folder and move it to trash.

NOTE: You don’t have to back up the files before you migrate them. If you have a drive, in which you have installed Linux, you can connect it to your new PC, navigate through your user’s account home folder and copy all files.

  • Copy all files that begin with the . character to migrate them in your new Linux distribution. This process works better, if your old and new Linux distributions are the same.

Back up All your Settings

You can also use the Déjà Dup tool to back up your user’s account configuration settings. This backup tool is preinstalled in Ubuntu. Once your configuration settings are backed up, you can restore them later in your new PC. The Déjà Dup tool will allow you to restore every configuration setting of your user account, compared with the Windows backup tool that helps you to restore just your files. 

Sync your Settings Online

You can synchronize your settings folders on the Internet by using cloud storage services, such as DropBox. The synchronization becomes even more easy, if you use a cloud storage service that allows you to choose and then synchronize any file or folder in your operating system.

In this article we focused more on user account configuration files, because they are the most popular files that Linux users want to take with them in their new PCs. On the other hand, system files usually refer to specific Linux distributions, so it is better to avoid backing them up and restore them in your new computer. However, if you still want to back up system files like server configuration files, you can simply back them up and then restore them on the same location of your new PC. We should inform you though that different distributions often store these kinds of configuration files in various locations, so you should consider placing your configuration files in another location.