Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 32438  / 1 Year ago, fri, december 16, 2022, 10:46:20

I'm trying to get the profile directory of the default firefox profile (the one that opens automatically) from Bash. How could I proceed? I can't find any useful options issuing firefox --help


More From » firefox

 Answers
2

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.


[#33261] Saturday, December 17, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
ingssex questions
;