Is there a way to list the open tabs in Firefox from the command line?

5 Answers 5


The idea would be to access Firefox data from the 'outside'. You might want to look at Stack Overflow question How can I get list of open tabs in Firefox via a command-line application?.

  • 2
    Ahhh - the sessionstore.js (JSON) file in your FF profile does seem to contain the appropriate list. Albeit inside a lot of noise. Seems structured enough to parse out though. Thanks for the link.
    – kenny
    Apr 11, 2011 at 16:31
  • Heh - as soon as I get 15 rep, I'll drop back and +1 you :)
    – kenny
    Apr 11, 2011 at 17:58

The format in latest versions is JSON compressed with LZ4 + a magic header (mozLz40\0).

This small python script will print tabs: https://gist.github.com/tmonjalo/33c4402b0d35f1233020bf427b5539fa

  • To use it in Ubuntu, you need to sudo apt install python3-lz4
    – mivk
    Nov 13, 2021 at 20:28
  • the code above works, but one may have another folder under linux, support.mozilla.org/en-US/kb/… this is a link to find a right one (originaly suggested by mwalkerr) Nov 14, 2023 at 20:18

I recommend using https://github.com/balta2ar/brotab for this purpose:

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 run brotab commands such as:

brotab list

In Linux, you can do it with this (admittedly long) command:

lz4jsoncat $profile/sessionstore-backups/recovery.jsonlz4 \
| jq -r '.windows[] | .tabs[] | (.index - 1) as $i | .entries[$i] | .title, .url, ""'

This assumes you have set the $profile variable to your current Firefox profile with something like


It needs the lz4json and jq packages. In Debian or Ubuntu, install them if needed with :

sudo apt install lz4json jq 

According to the mozilla site, no. Command Line Options

Although you could write a plugin to write tab names to a text file I guess.

  • Thanks, I think your answer is the "right" one from a supported standpoint. But, hack > nothing.
    – kenny
    Apr 11, 2011 at 18:15
  • No worries :) happy hacking
    – nopcorn
    Apr 11, 2011 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .