19

I'd like to write a shell script that automatically transfers all tabs from Chrome to Firefox (by getting the list of tabs from Chrome, and then opening them in Firefox with a script.) In Google Chrome, is it possible to obtain a list of open tabs via the command line?

8

This question was not answered, solution above is for Chrome Dev Tools where the OP asked in CLI, so this is the solution I've found :

strings ~/'.config/chromium/Default/Current Session' | 'grep' -E '^https?://'
2

I finally found a duplicate question (it took a lot of searching to find it, though): https://stackoverflow.com/questions/4968271/chrome-on-linux-query-the-browser-to-see-what-tabs-are-open

1

You could also use the open-source utility chrome-cli. You can install with Homebrew:

brew install chrome-cli

Also, take note of one thing from the README:

To execute javascript you must first allow it under View > Developer > Allow JavaScript from Apple Events.

Here's what it looks like:

$ chrome-cli list tabs
[1889] Edit - Super User
[1918] prasmussen/chrome-cli: Control Google Chrome from the command line
[1905] Yotto Winter Mix 19 by Yotto
$ chrome-cli list links
[1889] https://superuser.com/posts/1407956/edit
[1918] https://github.com/prasmussen/chrome-cli
[1905] https://soundcloud.com/yotto/yotto-winter-mix-2019

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.