search google from terminal

How to Do Google Search from Terminal

Sometimes you may need to do a Google Search from command line and use its results to perform some tasks or processes. For example, you may want to find out a specific Stock price or currency exchange rate and run a set of commands to perform trading online. It can be tedious to do this using the traditional cURL or wget commands. Luckily there is a nifty tool called Googler that allows you to easily search stuff on Google, right from within your Linux terminal. In this article, we will learn how to do Google Search from terminal using Googler.

How to Do Google Search from Terminal

Here are the steps to do Google Search from terminal. Googler is a python-based tool that allows you to not only search Google, but also look for information in Google News, that match your search queries.

When you search for terms in Googler, it presents the search results in an easy-to-understand manner, consisting of title, URL and a short text snippet.

It also provides many search options and parameters for advanced users. You can use them to search for exact phrase, within specific time period, or even a specific version of Google. You can also limit the number of search results to be displayed, or even create an alias to run the search regularly.

Run the following commands to install pre-requisites for Googler.

$ sudo apt-get install python3.5 xsel xclip

Next, run the following command to install Googler.

# On Ubuntu/Debian:
$ sudo apt install googler

# On Fedora:
$ sudo dnf install googler

#On CentOS 8:
$ sudo dnf install epel-release
$ sudo dnf install googler

Once you have installed Googler, you can start it with the following command.

$ googler

You will be prompted for search query. Enter it to search Google as per your requirement. Alternatively, you can include search string after googler command. If it is a multi word search string, enclose it within quotes

$ googler 'san francisco'

You can use –count option to limit the number of search results, use –time option to specify the time duration when the search results were published. Here is an example to see top 4 results about flowers, limited to those results that were published in last 5 hours.

googler --count 4 --time h5 flowers

You can check out all available options for googler, using –help option.

$ googler --help

In this article, we have learnt how to do Google search from terminal.

Also read:

How to Backup WordPress to Dropbox
How to Download Attachment from Gmail using Python
How to Read File Line by Line into Python List
How to Backup WordPress to GitHub
How to Backup WordPress to Google Drive

Leave a Reply

Your email address will not be published. Required fields are marked *