We recently published an article on how to backup and restore a Google Chrome profile on Linux, now, our concentration is on Firefox.
Like I did in the Chrome article, I’ll list the steps required to backup and restore your Firefox Profile. The listed commands are for you to copy and paste in your terminal after you may have edited them to suit your needs e.g. your preferred directory path. None of the terminal commands requires root access.
A backup of your Firefox profile enables you to save all your browser data (extensions, history, settings, etc.) on your local machine or any other storage medium so that you can restore it at a later time in case of a system failure, fresh installation, or migration. What’s cool about this method is that you don’t need to be connected to the Internet.
Firefox Profile Backup
1. Launch your terminal and navigate to the
~/.mozilla directory from your home folder with the following command.
$ cd ~/.mozilla
2. Use tar command to compress your entire
~/.mozilla directory into a GZip archive with the following command.
$ tar -jcvf firefox-browser-profile.tar.bz2 .mozilla
3. Once the compression is complete, move the archive file to any safe location of your choosing. This time around, let’s move the archive to the
$ mv firefox-browser-profile.tar.bz2 ~/Desktop
That’s it. You can now back the profile archive to secondary storage devices or your preferred cloud service to restore it whenever.
Firefox Profile Restore
1. Remove entire Mozilla’s configuration directory.
$ rm -rf ~/.mozilla
2. Next, unzip the
~/.mozilla folder in your home directory with the following command:
$ tar -xvf firefox-browser-profile.tar.bz2
Now you can run Firefox with all of your bookmarks, history, extensions, etc. back in place.
Encrypt Firefox Profile Backup
You already know by now that it is important to back up your profile with encryption because it restricts your data to you and users with the key as the file will be virtually useless to anyone without the rights to decrypt the archive.
It takes a couple more steps to complete but we can easily complete them with GnuPG. If it’s not installed, you can install it using following command.
$ sudo apt install gnupg [On Debian/Ubuntu] $ sudo yum install gnupg [On CentOS/RHEL] $ sudo dnf install gnupg [On Fedora]
After you have created the backup, enter the following terminal command from the directory containing the backup.
$ gpg -c firefox-browser-profile.tar.bz2
Enter a secure password when
gpg -c prompts you for one. Once done with the encryption, save the
firefox-browser-profile.tar.bz2.gpg file and delete the unprotected
You can decrypt the archive at any time with:
$ gpg firefox-browser-profile.tar.bz2.gpg
Do you have any comments or questions to contribute? Drop them below in the comments section.