2

I want to simply be able to open a website from a curl command. I haven't been able to find anything related as of yet. All the results that pop up are mainly for mobile apps and their respective development languages. I want to be able to do:

curl <some flag or option> google.com

And then the google.com webpage pops up. Is something like this possible?

Marco R.
  • 47
  • 1
  • 7
  • Is it because you need to download the `.html` file, and then open it? Or could it directly open your URL in the default browser? E.g. this should work on ubuntu: `curl URL > file.html && xdg-open file.html` or directly `xdg-open URL`. – Jeppe Apr 12 '22 at 19:52
  • @Jeppe Yeah the second part. Mainly wanted to open directly in the browser, but without wanting to download the file. I will try this either way to see if it helps with my use case. – Marco R. Apr 12 '22 at 20:38
  • @Jeppe Yes it worked! Thank you! I did `xdg-open URL` and it opened the site in my default web browser properly. – Marco R. Apr 12 '22 at 20:44
  • Okay, but then your question is not really related to `curl`. You should update the question to reflect that. – Jeppe Apr 13 '22 at 11:53
  • Okay just did. Thank you for your help! – Marco R. Apr 13 '22 at 17:47

1 Answers1

3

Lets collect the various ways to open a URL the default browser:

Ubuntu

sensible-browser google.com or xdg-open google.com.

This is also answered here: https://askubuntu.com/questions/8252/how-to-launch-default-web-browser-from-the-terminal

Windows

start chrome https://www.google.com/ or start firefox https://www.google.com/

Answered here: https://stackoverflow.com/a/32775952/3717691

MacOS

open "google.com"

Answered here: https://stackoverflow.com/a/23039509/3717691

Jeppe
  • 1,830
  • 3
  • 24
  • 33