Because you mentioned:
... from any terminal command
I suggest a Python library named BroTab:
$ pip install --user brotab$ bt install
You need to install browser extensions then: Firefox, Chrome.
After all you will be able to list tabs and active ones with bt list
, bt active
from any terminal.