Start Web Search on GUI Browser from Command Line

Check tutorial of Start a Web Search in a GUI Browser from the Command Line

So after a lot of requests from our users here is a guide about Start a Web Search in a GUI Browser from the Command Line.

Using a simple command line function, you can quickly start a web search in your GUI web browser of choice right from the Terminal app. We’ll cover a few examples, demonstrating how to search the web using Google, Bing, Yahoo, and Wikipedia, and use a variety of web browsers, including Chrome, Safari, and Firefox. Since the command syntax is fairly straightforward, you can further customize the search functions or apps you use as you see fit.

Set up the web search in the bash profile

The feature example given here uses Google Search in the Chrome browser and we assume that you are using bash as your shell, which is the default in OS X. Check out the other command syntax options below to make adjustments to the web bring search or browser accordingly:

  • Go to the Terminal (found in / Applications / Utilities /, but you already knew that) and open .bash_profile, for this walkthrough we will be using nano to accomplish this task as it is simple:
  • nano .bash_profile

  • Copy and paste the following syntax at the end of your bash_profile on a new line:
  • function google () {open / Applications / Google Chrome.app/ “http://www.google.com/search?q= $ 1”; }

  • Now press Control + O to save the changes, then Control + X to exit nano and return to the command line

Now you can start a Google search through Chrome right from the command line. You just need “google And a new Google search is started in the Chrome browser. For example, if you search Google for ‘apple’, just type the following:

google apple

For phrases with multiple search terms, use quotation marks as follows:

google “MacBook Air is the market leader for thin and light notebooks”

Every new search from Google brings up a new Chrome browser window.

Do you prefer Safari or Firefox? Or maybe you want to search Bing or Wikipedia? All you need to do is change or add the correct open command string along with the correct search URL to point to the alternative browser app and search engine.

Alternative command line functions for web search

The command syntax is fairly straightforward and conforms to the following syntax:

function NAME () {open /path/to/application.app/ “SEARCH_URL”; }

Create your own or use one of the additional sample job functions for various search engines and web browsers. Don’t forget to put each command string on a new line in .bash_profile to avoid conflicts.

Start a Google search in Safari from the command line

function google () {open /Applications/Safari.app/ “http://www.google.com/search?q= $ 1”; }

Start a Google search in Firefox from the command line

function google () {open /Applications/Firefox.app/ “http://www.google.com/search?q= $ 1”; }

As with customizing which browser to use, you can change the search string to Yahoo, Bing, Wikipedia or whatever other web search you want to use by putting the following strings in .bash_profile:

Search Bing in Chrome from the command line

function bing () {open / Applications / Google Chrome.app/ “http://www.bing.com/search?q= $ 1”; }

Search Yahoo in Chrome from the command line

function yahoo () {open / Applications / Google Chrome.app/ “http://www.yahoo.com/search?q= $ 1”; }

Search Wikipedia in Chrome from the command line

function wikipedia () {open / Applications / Google Chrome.app/ “http://en.wikipedia.org/wiki/Special:Search?search= $ 1”;}

Using any of these alternative search functions is done in the same way as the first Google example, you just need to change the initial command string to start the search. And yes, this also works to send searches to the X11 version of Lynx (Links) if you want to be a little meta.

Deviating from questions could use a variation of this too trick to open your favorite website directly from the command line, for example:

function compsmag () {open / Applications / Google Chrome.app/ “https://compsmag.com”; }

That said, if you’re not using search queries, it probably makes more sense to use a generic alias instead.

Start a Web Search in a GUI Browser from the Command Line Guide is free?

Starting from: Free
This guide is a free model
Free Trial: May be included, please check on the official site, we mentioned above.
The Start a Web Search in a GUI Browser from the Command Line tutorial price is Free or Freemium. This means you can truly enjoy the Start a Web Search in a GUI Browser from the Command Line guide.

The Start a Web Search in a GUI Browser from the Command Line guide gives you an easy-to-use and efficient management and Start a Web Search in a GUI Browser from the Command Line allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and Start a Web Search in a GUI Browser from the Command Line tutorial can be used on Linux, Windows or android devices.

Start a Web Search in a GUI Browser from the Command Line: benefits

  • The Start a Web Search in a GUI Browser from the Command Line tutorial is free .
  • Helps many users follow up with interest in a timely manner.
  • The price of the Start a Web Search in a GUI Browser from the Command Line guide is free.

Start a Web Search in a GUI Browser from the Command Line: FAQ

Tutorial Summary: Start a Web Search in a GUI Browser from the Command Line

In this guide, we told you about Start a Web Search in a GUI Browser from the Command Line; please read all steps so that you understand Start a Web Search in a GUI Browser from the Command Line in case if you need any assistance from us, then contact us.

How this tutorial helping you?

So in this guide, we discuss the Start a Web Search in a GUI Browser from the Command Line, which undoubtedly helps you.

What is actual time in which this method complete?

The time to complete the Start a Web Search in a GUI Browser from the Command Line tutorial is 10+ minutes.

What are the supported Device?

Apple

What are the supported Operating system?

mac OS


Start a Web Search in a GUI Browser from the Command Line Tutorial: final note

For our visitors: If you have any queries regards the Start a Web Search in a GUI Browser from the Command Line, then please ask us through the comment section below or directly contact us.
Education: This guide or tutorial is just for educational purposes.
Misinformation: If you want to correct any misinformation about the guide “Start a Web Search in a GUI Browser from the Command Line”, then kindly contact us.
Want to add an alternate method: If anyone wants to add the more methods to the guide Start a Web Search in a GUI Browser from the Command Line, then kindly contact us.
Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.

Compsmag
Logo