Get the default Firefox profile directory from bash
Try grep 'Path=' ~/.mozilla/firefox/profiles.ini | sed s/^Path=//
. Default profile folder name is stored in profiles.ini
. This will work fine while you've got single profile.
If you have more than one Firefox profile then the file format changes, so extracting the folder name becomes more tricky. Here's the script to do that:
#!/bin/bash
cd ~/.mozilla/firefox/
if [[ $(grep '\[Profile[^0]\]' profiles.ini) ]]
then PROFPATH=$(grep -E '^\[Profile|^Path|^Default' profiles.ini | grep -1 '^Default=1' | grep '^Path' | cut -c6-)
else PROFPATH=$(grep 'Path=' profiles.ini | sed 's/^Path=//')
fi
echo $PROFPATH
This script will work in both cases, it selects the appropriate method depending on the amount of profiles. Works in OSX, too.
Your default profile directory is stored under home directory.
cd ~/.mozilla/firefox
Here you will find something like xxxxxxxx.default. This is the location where all your personal data is stored.
You can run the command firefox -P
to show the profiles available and select one from the list.