How can I get list of open tabs in Firefox via a command-line application?

not in PowerShell but I recently faced this problem so maybe this onliner can help someone:

cat recovery.js | sed 's#{"url":"#\n\n#g' | cut -d'"' -f1 | grep . | sort -u

Using the JSON module from PoshCode, this looks right (bear in mind: I tested this on Firefox 4, where the Tab Panorama results in "hidden" tabs, ymmv).

ConvertFrom-Json -File ~\AppData\R*\M*\F*\P*\*\sessionstore.js -Type PSObject -EA 0 |
Select -Expand Windows | Select -Expand Tabs | 
Where { !$_.hidden } | ForEach { @($_.Entries)[-1] } | 
Select Title, Url

All the * in the first line are just to make it short. Feel free to expand that to the full path if you care about the (milli)seconds spent searching.


I'd recommend using brotab to get the URLs of all open tabs:

pip install brotab
brotab install

Install the web extension as well: https://addons.mozilla.org/en-US/firefox/addon/brotab/

Restart Firefox, and you can use brotab list and parse it as so:

bt list | awk -F'\t' '{
    print $2
}' > urls-backup.txt

Then open all URLs in urls-backup.txt with normal Firefox:

while read url; do
    firefox "$url"
done < urls-backup.txt