Open Multiple URL in Chrome from Terminal

Written by Arvind


Working on a CMS can be tedious, especially if most of the configuration is done in the admin panel. Going to a page by page is time-consuming. In my case I have to update a bunch of sites, to cut down the time of updating them. I create a small script the open all the tabs for me.

Open your bash_profile.

subl `~/.bash_profile

` or you can do

sudo vim ~/.bash_profile

Create an alias/shortcut to open your google chrome

alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"

Now create function with one argument(url/webpage)

function openTab(){
    chrome "$1"
}

Close your .bash_profile, open your terminal and source the file

source ~/.bash_profile

Execute the bash function

openTab http://www.google.com

Opening multiple URLs and specifying their succeeding path.

function openTab(){
    chrome "$1/user" \
    "$1/mail" \
    "$1/calendar" \
    "$1/maps" \
    "$1/drive"
}

Then I call the function, specifying the domain name as an argument.

openTab http://www.google.com

I’m sorry for using google as our domain sample. Our argument can take any domain/URLs you put in as many as you can. My function is a bit crazy but useful.

function openTab(){
    chrome "$1/user" \
    "$1/admin/config/workflow/workflow/manage/node/fields" \
    "$1/admin/structure/types/manage/e-resource/fields" \
    "$1/admin/structure/types/manage/directory-listing/fields" \
    "$1/admin/structure/types/manage/event/fields" \
    "$1/admin/structure/types/manage/library-branch/fields" \
    "$1/admin/structure/types/manage/news/fields" \
    "$1/admin/structure/types/manage/guide/fields" \
    "$1/node/add/e-resource" \
    "$1/node/add/directory-listing" \
    "$1/node/add/event" \
    "$1/node/add/library-branch" \
    "$1/node/add/news" \
    "$1/node/add/guide"
}

I hope this small scripts can you some day. Chow!!!