how to backup your configuration files in Linux

What's more pleasant when you change distribution to have available his configuration files carefully preserved?

When you spend time tweaking the configuration of the display server or its favourite text editor, the idea of ​​losing these famous files gives cold sweats.

Only when we want to make a backup of these files we must do everything by hand and especially we always tend to forget some.

This for this reason that I tinkered a little script Bash that collects your conf files and makes a nice tar.bz2 archive ready to be copied away from crashes.

You can download the script in question here:

This script is very easily customisation. It is divided into two sections: the first contains the commands (the script itself) and the second part is a list of files to save.

You can add filenames as well as directories. In all cases we must give the full path from the root (/). If you indicate a directory, all its content will be copied ... so think about what you add! It may be best to give filenames belonging to the same directory rather than giving the entire directory (I am thinking in particular of the hidden directories used by browsers which contain the cache of your navigation).

Launched as a lambda user, saves the system configuration files (in / etc, / usr ...).

Launched in root, the script will additionally record the configuration of each "human" user (whose uid is greater than or equal to 500)

User configuration files must be indicated using the keyword _USER_ which will be replaced when using the script by the home directory of this user (nothing very complicated, you will easily understand by looking at the list of files by default).

Small note: does not keep the file permissions in memory ... but it is easily modifiable by modifying the arguments passed to tar and cp.

The script needs bash, awk, tar and bzip2 to work.

Previous Post Next Post