12

How I would go about opening multiple URLs from a text file as different tabs in Firefox/Chrome? My text file is just a list of URLs, one per line:

http://www.url1.com
http://www.url2.com
http://www.url3.com
http://www.url4.com
12

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

while read line; do
    firefox --new-tab "$line"
done < textfile.txt

With Chrome, the syntax is:

google-chrome "$line"
  • 1
    On OS X you can make this work with Chrome with something like alias google-chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'. Probably similar for Firefox. – David Winiecki Dec 11 '14 at 20:58
2

I think this may be a nice solution:

cat /home/username/anyfolder/allmyURLs.txt | xargs firefox -new-tab
  • "$line" is wrong in this answer: xrag applies the strings from the input file each as parameter to its subcommand. I corrected the answer accordingly. – halloleo May 25 '15 at 3:02
1

This question is very old but I will answer it to the benefit of people who will read it in the future.

If there is only a number changing in the url, then you can change the number as given below. If they are different urls then you can use jasonwryan's solution.

google-chrome --new-tab http://www.url{1..4}.com

The above command will expand as below in new google chrome tabs:

http://www.url1.com http://www.url2.com http://www.url3.com http://www.url4.com

This solution is typically to load all pages where you would have to do next, next to go through the pages.

0

On windows / cygwin... this worked for me:

#!/bin/bash -xe

browser="/cygdrive/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"

clients="fb aapl nflx "

for i in $clients
do
        "$browser" --new-tab https://asite.com/dashboard/$i
done

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.