Hello there.
I’d like to post this tip for newbies. After having installed umpty linux distros on various computers, some things always get to be done repeatedly, if we have no configuration backups handy. This includes long, sometimes tedious configurations, such as bookmarks, settings, browser extensions, and so on. Therefore, here’s a quick and simple solution to this, using rsync to backup special folders inside one’s home-folder. - Rsync appears to be the fastest way to do any backups in linux via a simple shell-script, afaict.
If you have multiple email-accounts, don’t forget to include your .thunderbird - folder. Customize below code example according to your own needs.
The example is quite self-explanatory, and some further hints are given below.
First, the script-code:
#!/bin/bash
TIME=`date +%b-%d-%y`
FILENAME=backup-$TIME.tar.gz
SRCDIR1="/home/MyUsername/.config/chromium/"
SRCDIR2="/home/MyUsername/.mozilla/firefox/"
SRCDIR3="/home/MyUsername/tor-browser_en-US/"
SRCDIR4="/home/MyUsername/.librewolf"
DESTDIR="/Path-to/MyDrive-Folder/"
cd $DESTDIR && tar -cvpzf $FILENAME -C / $SRCDIR1 $SRCDIR2 $SRCDIR3 $SRCDIR4
find /Path-to/MyDrive-Folder/* -mtime +14 -type f -delete
The last line of the script simply means this:
Find all files inside the destination directory and delete files older than 14 days.
Replace username and destination folder in the above code-example:
“SRCDIR1” to “SRCDIR-X” →
Replace MyUsername with your actual username.
“DESTDIR” →
Replace /Path-to/MyDrive-Folder/ with actual path to destination-drive/folder twice: Don’t forget the script’s last line, starting with the find-command.
Next, save it all to a text-file.
Example name for script: “backup.sh”. Save inside your home-folder.
Make the script executable:
chmod +x backup.sh
Run it from terminal:
./backup.sh
The script can also be executed regularly as a cron-job, according to one’s liking.
See: https://wiki.archlinux.org/title/cron