31

I'm trying to open firefox with two tabs from the command line, with two separate web addresses. So far I'm having no luck.

firefox -new-tab https://www.evernote.com/Home.action -new-tab http://www.gmail.com

Could someone point me in the right direction?

muru
  • 193,181
  • 53
  • 473
  • 722
Andy J
  • 1,048
  • 1
  • 12
  • 18

3 Answers3

35

Oops. I just found the answer. You need to add a -url after each `-new-tab'.

firefox -new-tab -url https://www.evernote.com/Home.action -new-tab -url http://www.gmail.com

Now it works. Hope this can help somebody.

muru
  • 193,181
  • 53
  • 473
  • 722
Andy J
  • 1,048
  • 1
  • 12
  • 18
12

You no longer need to add -url, simply write firefox followed by space-separated URLs.

Example:

firefox mail.google.com askubuntu.com stackoverflow.com
holocronweaver
  • 886
  • 1
  • 9
  • 18
Kapil Singh Rawat
  • 173
  • 1
  • 2
  • 7
  • This is a nice solution. Personally, I run it at startup using CTRL+R to recall the line and with a & at the end of the command to detach the firefox session from the terminal - just a suggestion. – somethis Aug 07 '19 at 09:38
  • 1
    This is not working for me. The only change that I did was that I have added a new profile in firefox and set it as the default. Now when I try the above solution, I get the following error ```Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile.``` Firefox is not stuck though. Both the new profile and the default one are working fine from the UI. – livinston Mar 02 '21 at 03:28
8

Create a file containing list of URLs called url.txt:

http://www.url1.xxx
http://www.url2.xxx
http://www.url3.xxx

Firefox uses the new-tab command, so you could pass the URLs in the file to the browser like so:

xargs -a url.txt firefox -new-tab "$line"
muru
  • 193,181
  • 53
  • 473
  • 722
Maythux
  • 82,867
  • 54
  • 239
  • 271
  • @Maythus awesome – alhelal Jul 19 '16 at 09:41
  • this approach generates the same popup error cited by @livinston – user2901351 Jan 19 '22 at 17:46
  • this approach generates the same popup error cited by @livinston additional info: I am using firefox 96. This issue only appeared somewhere after version 90 (or with whatever ubuntu 20.04.3 updates were made in this timeframe). Not clear to me if this is a firefox issue or an ubuntu one, but the fact that I get the same error when running the equivalent command for vivaldi, brave, and opera makes me think is an issue brought upon us by GNOME or ubuntu. https://askubuntu.com/questions/1374403/after-firefox-94-update-cli-launch-half-broken – user2901351 Jan 19 '22 at 18:40