Is it possible to open a website from terminal without it actually opening a new tab?

eg: open https://www.google.co.uk/ would open a new tab in the default application and go to that website.

I just want a command which mimics that call to the website but not open a tab or show anything.

Reason behind this is that I'm trying to call a command on a website, but don't want anything to pop up, I just want it to call the command.

  • What is the reason for wanting to "call the command"--you're wanting the Web server to take some action for you? – chrylis -cautiouslyoptimistic- Nov 3 '17 at 6:43
  • @chrylis that is correct. The website doesn't expose an API for what I want to achieve, but there is a button that a user can press which can do it, and you can see the URL the button click would do. – Rekovni Nov 3 '17 at 9:15
  • 1
    You may be interested in headless chrome: developers.google.com/web/updates/2017/04/headless-chrome. chrome --headless --disable-gpu https://www.google.com this runs also javascript (while curl does not). – Bakuriu Nov 3 '17 at 10:57

You can use curl

curl https://www.google.co.uk/

and if you don't want the output

curl --silent https://www.google.co.uk/ > /dev/null
  • 17
    This is assuming that you only wish to do the request, but don't care about 1) JS on the page 2) images on the page 3) secondary requests on the page, etc. Otherwise you will need to use a headless browser. – David Mulder Nov 2 '17 at 12:24
  • @DavidMulder Or use a CLI-friendly REST API if available. – chrylis -cautiouslyoptimistic- Nov 3 '17 at 6:44

Curl and Wget can be used to call a website, but if you are wanting to mimic some function on the website then these wont accurately mimic a user running a request in a browser.

Browsers have engines in them that process css, javascript and html that's why you have to use them.

If you want to use a website as if a user was using the site through a browser without opening the browser you should look into some headless testing frameworks such as PhantomJS, otherwise browserstack a browser testing platform has an api you can access, this will still open a browser tab but in a cloud vm somewhere so no on your actual machine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .