Linux is a powerful operating system that can be used for many different purposes. One of the most popular uses for Linux is to run applications and files. However, sometimes it can be difficult to keep all of the configuration files in one place. This can lead to problems if you want to back up or migrate your Linux configuration files. To help you with this, we will take a look at some tips on how to back up and migrate your Linux configuration files. We will also discuss some of the different ways you can do this.
- Back Up Your Configuration Files One way to back up your Linux configuration files is by using a software package such as dd or mkdir . You can then use these commands to create a backup of your configuration files: dd if=/dev/zero of=/tmp/configs bs=512 count=1 This will create a backup of all of your configuration files in /tmp/configs . You can then use this backup to move or copy these files into another location:
- Backup Your Configuration Files Using tar -xvf ../../configs | tar -C ../../configs | cp -a ../.bashrc ~/.bashrc ~/.profile ~/.bash_logout ~/.login ~/.profile2 . This willBackup all of your configfiles in /etc/default/linux and store them in /tmp/.config . You can then use this backup to move or copy these files into another location: 3) Backup Your Configuration Files Using cp -a ../.bashrc ~/.bashrc ~/.profile ~/.bash_logout ~/.login . This willBackup both the original file (.bashrc ) and the new file (.profile ). You can then use this backup to move or copy these files into another location: 4) Backup Your Configuration Files Using cp -a ../.ssh/* | cp -a ../.ssh/* | mv -f .ssh/* $HOME
Linux applications store their settings in hidden folders inside each user account’s home folder. This makes application settings much easier to back up and restore than they are on Windows, where settings are scattered across the registry and system folders.
Whether you just want a backup copy of your settings, or if you’re moving to a new Linux distribution or another PC, you can easily create a copy of your application settings and take them with you.
View Your User Account’s Configuration Files
RELATED: 7 Ubuntu File Manager Features You May Not Have Noticed
First, locate your user account’s configuration files. Open your Linux distribution’s file manager to your home folder and activate the “Show Hidden Files” option in your Linux desktop’s file manager.
For example, on Ubuntu, open the Nautilus file manager and it will go straight to your home folder by default. Click the View menu and select Show Hidden Files.
You’ll see many different files and folders, all of them beginning with a period. That’s how you hide files and folders on Linux — just rename them so that their name starts with a . character. File managers will hide them by default so they don’t get in the way.
Locate an Application’s Settings Folder
Different applications often have their own folder under your home directory. For example, Pidgin stores all its settings, log files, and other data in the .purple directory. Firefox stores its installed extensions, ache, settings, and other data in the .mozilla directory.
Some applications have folders under the .config folder instead. Click around a bit and you should find where an application you want to back up stores its configuration files.
Some applications — particularly GNOME applications — use the older “Gconf” or the newer “Dconf” systems to store settings. Gconf settings are stored in .gconf, while dconf settings are stored in .config/dconf. Copy these entire folders and all the application settings contained in gconf and dconf will come with you to a new PC.
You could migrate an individual application’s settings from Gconf or Dconf using the gconftool or dconf commands. These commands allow you to dump parts of Gconf or Dconf to a file and restore them on another PC.
Back Up and Restore an Application’s Settings
To back up an application’s settings, just copy its configuration folder to a USB drive, external hard drive, cloud storage folder, or any other storage location. You can also right-click a folder in most file managers and create an archive file from it — the archive file can be more easily emailed, uploaded, and moved around.
Be sure to close an application before backing up its configuration settings. This will ensure the application exits and saves its settings properly, leaving a clean settings folder for your new Linux distribution.
Restore an application’s settings by placing its folder in your user account’s home folder on another Linux system. This is ideal when you’re reinstalling Linux and want to restore a crucial application’s settings, or just when you’re moving to a new Linux PC and want to keep your settings.
To be safe, you should delete or rename the existing configuration files before migrating your old ones over. For example, if you wanted to move your Firefox settings to a different Linux distribution, you should first delete the .mozilla directory on that Linux distribution before copying your old .mozilla folder over. This ensures you don’t have a mix of files from two different configuration folders
(If you ever want to erase a Linux application’s settings and start fresh, this is how you do it — head to your home folder, view hidden files, and delete the application’s configuration folder).
You don’t have to back up the files ahead of time, either — if you still have access to a drive with Linux installed on it, you can connect the drive to your new computer, browse to your user account’s home folder, and copy the folder over.
To migrate all your settings to a new Linux system, just copy over every file beginning with a . in your home folder — you can copy over every other file beginning with a . character, too. This will work best if you’re moving to a system running the same Linux distribution — for example, from a computer running Ubuntu 14.04 to a different computer running Ubuntu 14.04.
Easily Back Up All Your Settings
RELATED: How to Back Up Ubuntu the Easy Way with Déjà Dup
Ubuntu’s built-in Déjà Dup backup tool also backs up your user account’s configuration settings by default. They can then easily be restored to an Ubuntu system in the future. Unlike a backup on Windows that will just restore your files, a Déjà Dup backup will restore all your user account’s settings. They’re all just files in your home folder.
Synchronize Your Settings Online
You can use cloud storage services to synchronize these settings folders over the Internet, sharing them across PCs and having a backup copy online. We previously covered synchronizing your configuration files with Ubuntu One, but Ubuntu One has been shut down. Dropbox and other tools can still be used to synchronize your important configuration files. If you use a cloud storage service that allows you to pick and choose any folder or file on your system to synchronize, this is easy.
Dropbox itself doesn’t let you choose individual folders to synchronize outside the Dropbox folder. You’ll need to create symbolic links that will trick Dropbox into synchronizing these files. We covered this when we looked at how to synchronize your Pidgin settings across all your PCs. If you use a cross-platform program like Pidgin, you can even share the same settings between Linux and Windows PCs.
We focused on user account configuration files, as they’re what most Linux users will want. System-wide configuration files are often specific to a Linux distribution or hardware setup, so you wouldn’t want to back them all up and restore them on another PC.
If you have specific system-wide configuration files you want to back up and restore — for example, server configuration files — you should be able to just create backup copies and restore them to the same location on another PC. Bear in mind that different Linux distributions may store these configuration files in different places, so you may have to place that configuration file somewhere else.
Image Credit: David Sanabria on Flickr