-2

Is it possible to search the internet from the terminal? For instance, could I write some command followed by say https://github.com and it will automatically open a browser with that site through the http protocol?

  • The title of your question and the example you pose really are not the same thing. Opening a URL that doesn't perform a search query from Terminal is not searching the Internet, it's just opening a URL. You should clarify the Title to match the question or clarify whether or not you actually want to employ a command line utility that can actual preform a search. – user3439894 Aug 19 '18 at 14:46
  • In the following example command, the URL is engaging the search engine of the site, open "http://google.com/search?q=Cody Rutscher" however, there are third-party command line utilities that can also preform an Internet search base on the arguments passed. What is it you're actually looking for? – user3439894 Aug 19 '18 at 14:54
  • Consider editing this - the community strongly prefers one question per question. Tacking on “also, how can I do this other related thing” is a sure way to get lots of down votes and questions closed. – bmike Sep 6 '18 at 17:31
5

You could use the /usr/bin/open command to open websites from the command line.

Simply entering open http://www.github.com would open GitHub in your default browser.

You can further specify which browser you would like to use, if perhaps it’s not the default one, by using the -a switch for the open command. For example, open -a "Safari" http://www.github.com would open GitHub in Safari even if your default browser is set to Chrome.

The open command is very powerful and can be used to launch all finds of stuff from the command line. I have an alias set to open Finder in whatever folder I pass as a parameter, so that when I type f ., it opens Finder in whatever directory I’m working in in Terminal. You could do the same with Google, with a bit of creativity, and pass on your search parameters from the command line. You can also use it to open documents in specific applications, or simply to start an application by typing open -a "Preview" for example.

3

You can also browse the internet from within the terminal with browsers like Lynx (https://lynx.browser.org/), but from your question I'm not sure if this is what you want.

Lynx is commonly available for linux systems, and a quick google finds Lynxlet for Mac systems as well (https://habilis.net/lynxlet/).

Once installed, your command would be something like:

open -a Lynxlet https://github.com/

You must log in to answer this question.

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