User Agents

Web browsers and everyday web tech, explained

Back Up & Restore Browser Data on Linux

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Backing up your browser data on Linux means saving your bookmarks, saved passwords, history, extensions, and open tabs so you can restore them later — after a system reinstall, a browser crash, or when switching to a new machine. This guide shows you how to locate the data folders for Firefox, Chrome, and Chromium, copy them to a safe location, and restore them when needed. You'll need a file manager or terminal, and a destination for the backup (external drive, cloud folder, or another directory).

What You'll Need

  • A Linux system with your browser installed (Firefox, Chrome, or Chromium)
  • A destination for the backup: external USB drive, second hard drive, or a cloud-synced folder
  • Basic familiarity with the terminal (optional, but helpful)

Step-by-Step

  1. Close your browser completely. Backing up while the browser is running can result in corrupted or incomplete files. Save your work and exit all browser windows.
  2. Locate your browser's profile folder. The location varies by browser:
    • Firefox: ~/.mozilla/firefox/ — each profile is in a subfolder like xxxx.default.
    • Google Chrome: ~/.config/google-chrome/ — default profile is in Default/.
    • Chromium: ~/.config/chromium/ — same structure as Chrome.
  3. Copy the entire profile folder to your backup destination. Use the file manager (right-click → Copy, then Paste) or the terminal. For example, to back up Firefox:
    cp -r ~/.mozilla/firefox /media/backup/firefox-backup
    Replace /media/backup with your actual backup path. For Chrome:
    cp -r ~/.config/google-chrome /media/backup/chrome-backup
    This copies everything — bookmarks, passwords, extensions, cookies, and settings.
  4. Verify the copy. Check that the backup folder exists and has the same file count as the original. You can compare sizes with du -sh on both folders.
  5. Label the backup with a date. Rename the backup folder to include the date, e.g., firefox-backup-2025-04-01. This helps you track which backup is newest.
  6. To restore, close the browser and replace the profile folder. First, move the existing (possibly broken) profile folder aside:
    mv ~/.mozilla/firefox ~/.mozilla/firefox.old
    Then copy your backup back:
    cp -r /media/backup/firefox-backup ~/.mozilla/firefox
    For Chrome:
    mv ~/.config/google-chrome ~/.config/google-chrome.old
    cp -r /media/backup/chrome-backup ~/.config/google-chrome
  7. Start your browser. Open the browser and verify that your bookmarks, passwords, and extensions are present. If something is missing, double-check that you copied the correct folder.

Common Mistakes

  • Backing up while the browser is open. This can cause file locks and incomplete writes. Always close the browser first.
  • Copying only the bookmarks file. Bookmarks are stored in a file called places.sqlite (Firefox) or Bookmarks (Chrome), but passwords, cookies, and extensions are in separate files. Copying just one file loses everything else.
  • Restoring into the wrong profile folder. If you have multiple profiles, make sure you restore into the correct one. Check the profiles.ini file in Firefox to see which folder corresponds to which profile.
  • Overwriting a working profile. If you restore over a profile that already has data, you'll lose the newer data. Always move the existing folder aside first.
  • Ignoring permissions. If the backup is on an NTFS or FAT32 drive, permissions may be lost. When restoring, you may need to set correct ownership with chown -R $(whoami) ~/.mozilla or ~/.config.

Tips

  • Use a dedicated backup directory. Keep all browser backups in one place, like ~/browser-backups/, and organize by browser and date.
  • Automate with a script. Write a small shell script that copies the profile folder to a timestamped directory. Run it manually or via cron.
  • Use Firefox Sync or Chrome sync as a supplement. These cloud services sync bookmarks and passwords across devices, but they don't back up extensions or local settings. A local backup is still necessary for a full restore.
  • Compress the backup. To save space, create a tarball: tar -czf firefox-backup.tar.gz ~/.mozilla/firefox. This also makes it easier to move the backup to another machine.
  • Test your backup. After restoring, open a few bookmarks and check that passwords autofill. If something is wrong, you can restore again from the same backup.

Troubleshooting

  • Browser doesn't start after restore. This usually means the profile folder has incorrect permissions or the backup was corrupted. Check ownership: chown -R $(whoami) ~/.mozilla/firefox. If that doesn't work, restore again from a fresh backup.
  • Bookmarks are missing. Make sure you copied the entire profile folder, not just the bookmarks file. In Firefox, bookmarks are in places.sqlite; in Chrome, they're in the Bookmarks file. If you only copied one, the rest is gone.
  • Passwords don't autofill. In Firefox, passwords are stored in logins.json and key4.db. If these are missing, passwords won't work. In Chrome, they're in the Login Data file. Ensure these files are in your backup.
  • Extensions are gone. Extensions are stored in the extensions/ subfolder. If you didn't copy it, they won't appear. Reinstall them manually or redo the backup with the full folder.
  • Browser opens with a new profile. This happens when the profile folder name doesn't match what the browser expects. Check profiles.ini (Firefox) or the Local State file (Chrome) to ensure the folder name is correct.
  • Backup is too large. The profile can grow to several GB. Consider excluding cache files (cache2, Code Cache) which are not essential. Use rsync with --exclude to skip them.

Frequently Asked Questions

Can I back up only bookmarks and passwords?

Yes, but it's less reliable. Firefox allows exporting bookmarks to HTML and passwords to CSV, but restoring them requires importing, which may not preserve all metadata. Chrome's sync can restore bookmarks and passwords, but a full profile backup is the most complete method.

Will this work for any Linux distribution?

Yes, the profile locations are the same across all Linux distros because they follow the XDG base directory specification. The commands and file paths are identical on Ubuntu, Fedora, Arch, and others.

Can I restore a backup from a different browser version?

Usually yes, but older backups may not be compatible with newer browser versions. If you restore an old backup into a new browser, it may be upgraded automatically. If you restore a new backup into an older browser, it may fail to read the data.

Is it safe to delete the old profile after restoring?

Yes, once you've verified the restored profile works, you can delete the .old folder. But keep it for a few days in case you need to revert.

What if I use a browser not listed here?

Most Chromium-based browsers (Brave, Edge, Opera) store profiles in ~/.config/<browser-name>/. For other browsers like Vivaldi or Pale Moon, the pattern is similar. Check the browser's documentation or look for a folder with the browser's name in ~/.config or ~/.mozilla.

Does backing up include my open tabs?

Yes, open tabs are stored in the session files. In Firefox, they're in sessionstore.jsonlz4; in Chrome, in the Sessions/ folder. As long as you copy the entire profile, your tabs will be preserved.