Dotfiles during backup

Using rsync --av to backup my user directory. What is some good reading for what dotfiles I need to keep? There are a ton that are thumbnail cache, but there is a Firefox one, one for Thunderbird, etc. How do I know what to keep to keep settings etc., without filling up with some of the fillers?

I have a script that does more or less exactly that. All of my dotfiles end up on the backup drive, whether I need them or not.

When I have to restore the ones I actually care about are:

  • .thunderbird which I can copy back to the fresh system to save me from having to log back into several email accounts.
  • I have some custom aliases set in .bash_aliases

That’s about all I actually restore as far as dotfiles are concerned.

As mentioned I would back the hidden Mozilla and Thunderbird folders.
You have to see what applications you use. Most of the important config files are either in .config or in the respective application’s dot folder name.

Open the file manager and show hidden files and take a look.

@WalJT thanks! I backed up everything, I figured I would restore only what’s needed. The .thunderbird file will restore my accounts? Will it also pull down my folders/email locally again or will those re-download?

@vinylninja Thanks! Will the .Mozilla reimport my history and favorites too? I don’t have saved passwords, but I do have lots of history. I know I can manually do bookmarks, just curious about the rest. Thanks!

Yes, it will. I have a mozilla profile that I use for years and always take it with me in case I reinstall or have a new machine. Actually it is .mozilla in your home folder.

Yep… cached mail is also stored in that directory.

@vinylninja Thanks! It took me a few minutes to figure it out and I was worried I broke it, but I figured out I had to set that as the default profile. All my bookmarks, even the tabs I had up came back. Thanks for the help!

@WalJT Thanks! I had to do the same thing and choose the restored profile.

Thank you both very much!

To restore, I skipped all my dotfiles with rsync -av --exclude '.*' /from/source /home/user/ and then I went back and did just the .mozilla and .thunderbird files using rsync -av /from/source/.dotfile/ /home/user/.dotfile/

1 Like

I didn’t know you’d have to do that, since I’ve only ever restored to a completely fresh install before opening Thunderbird. I’ll keep that in mind for future reference anyway.

That is true because Firefox changed the profile managing. I forgot to add that. Now you have to go there and make your old profile default otherwise Firefox makes a new one that will be used after installation.

1 Like

I would just like to mention that there are a lot of dotfile backup utilities out there, that you might want to look at.
I’ve only ever tried yadm (i think I heard it recommended on a podcast by Martin Wimpress once), but there are at least a couple others in the Ubuntu repos and about a million more online.

Personally I use rsync and I create a bash file for each application to back up and all of these backup-application-name-here files are placed inside ~/bin/backupscripts/ and run automatically at an interval, but to your point, I really wish there was a good source of where applications store their config files, profiles and other data.

If you wish to automate it, check for the existence of /etc/{appname} for system-wide config, $HOME/.{appname} or $HOME/.config/{appname} for user configs and $HOME/.local/share/{appname} for additional stored files. This will back up about 80-90% of applications.

1 Like

Thanks @kobberholm

I personally use Git and GNU Stow to manage my dotfiles. Git allows me to track and document changes, sync them easily between computers, and even seamlessly roll them back if I need to, while Stow allows me to split them into categories that I can deploy on different machines. For example, I don’t need configs for graphical applications on a server, and I can avoid conflicts between different desktop environments. My setup was largely stolen from this blog post.

1 Like