Which files do I need to backup to keep my Linux user settings?

Solution 1:

The bare minimum would be to keep the user's own files within /home. Also, in order to know which files to keep from /etc it is beneficial to use a system like etckeeper that can track history of changes to /etc and who made them. IE - were they distribution changes, or changes that you made?

For the back up itself, I always copy the following:

/usr/local
/usr/share
/home
/var
/etc
/root

There are ways to back these up using Rsync to a separate area, using hardlinks so that additional space is not used on subsequent backups.

You can then restore /home/* as is, but you will want to pick specific files/folders as needed from /var and /etc. You will know if you need something specific from /usr/local, because most likely you will have put it there purposely.

The contents of /var and /usr/share can be tricky. Apache, mediawiki, wordpress, and various other services store data in either. You should know if you have any data stored in these by the configuration you did when you set up these services. If you don't run any 'server' or 'web' services, you may be safe not backing these up, but it's always wiser to backup than to wish you had backed up.

Unless you have hand-edited things in /etc you probably are safe with a clean config. If you do have hand-made-changes in /etc, it is best to port them over by hand so you know exactly what you are introducing to the clean system.

/opt may also be a directory of concern. It is usually created when installing software distributed with it's own installer from software outside of your distribution. Backing up this is an option, but you may want to re-install those packages - as they have configurations that require links back into /etc