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?

3 Answers 3

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.

2
  • Cool. That would be very usefull in Chrome as well.
    – Augusto
    Sep 8, 2017 at 9:09
  • For macOS users: /Applications/Firefox.app/Contents/MacOS/firefox --new-tab https://google.com
    – SgtPooki
    Nov 4, 2020 at 7:15
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
2
  • 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 7, 2019 at 9: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 2, 2021 at 3: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"
3
  • @Maythus awesome
    – alhelal
    Jul 19, 2016 at 9:41
  • this approach generates the same popup error cited by @livinston Jan 19 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. askubuntu.com/questions/1374403/… Jan 19 at 18:40

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.