Search Google from the terminal. Avoid distractions.

Search Google from the terminal. Avoid distractions.

Since English is only my second language, I regularly use Google Search to find the meaning of words that are new to me. I typically run the standard 'define the_word' terms which work great. BUT, the problem is I get distracted by all the graphics and ads and irrelevant links that are displayed in the browser, I end up going down the rabbit hole more times than I would care to admit. That translates into a lot of wasted time, all just because I wanted to look up a word!

'Googler' to the rescue!

Recently I came across this nifty tool, called Googler. It is an open-source tool, hosted on GitHub. I've been testing it out for a few days and have been so impressed by it, I thought I just had to share.

Essentially, Googler is a tool that enables you to pass your Google Search terms directly from the terminal, without opening a browser. And all results are returned back to the terminal. There is no need to open a browser when searching. You avoid all those distracting graphics, ads, and those special deals retailers throw at you! The results are returned as hyperlinks, so you can simply click on the links from within the terminal to open them in your browser.

Below follows a few basic examples to get you started.

See the section near the end of this article on how to install Googler. After it is installed, come back here and follow the steps below.

To find the definition of the word "zephyr", type googler define zephyr.

define zephyr.png

To limit the result to the first x2 links, simply add '-n 2', eg. googler -n 2 define zephyr. While you are at it, why not create your own custom command (alias), with your preferred search parameters permanently added? Like so:

create alias.png

Now run your custom search command, with results limited to the first two.

custom command results.png

Optionally, save the results to a file.

How to save googler results.png

Search for anything using Googler

Using Googler, you can search Google as you would normally do, for anything. You can search the entire web, or limit your search to a specific website. To limit your search to specific websites, add the '- w' parameter. For example type googler -w someSite2 - w someSite2 theTermTosearch

So let's search for courses offered by cloudskills.io. (note: I am keeping things short here, hence the screengrab below does not show the entire result set).

cloudskill course results.png

Or let's check for anything Pyhton related at cloudskills.io. (note: I am keeping things short here, hence the screengrab below does not show the entire result set).

cloudskills - python search.png

More precise searches

For more precise searches, there are many options available to you.

As an example, let's look for information on how to scan computer ports using Python3. But let's limit the results to the following:

  • Fetch the first x5 results [-n 5]

  • Starting from the 6th result [-s 6]

  • Which was updated within the last 10 months [-t m10]

How to search using date and keyword.png

Installing Googler

If your Linux distro supports snap packages (most major distributions do), then Googler can be installed with a single step. Like so:

demo_user:~$ snap install googler

Note: Check out the snapcraft guide on how to install the Snap package manager, if it is not already installed on your machine.

That's it from me

There is a whole lot more to this tool than what I have presented here. This bit is just to get you started. Read Googler's Readme file inside the GitHub repository for more information on additional installation options, configuration settings, and advanced search parameters.

Hopefully, this article was not just another rabbit hole for you! :)