How to Google search from Linux terminal – Build your own search engine

In this article we shall discuss how to Google search on Linux using a tool called Googler. Googler, a feature rich and Python based utility, allows users to query Google (Web and News) using the command line on Linux. This might help developers to integrate google search feature in their applications.

Googler main features

  • Provides access to Google Search, Google News and Google Site Search
  • Search options such as country, domain, duration or language preference
  • Search is fast and tidy with no ads
  • Automatic spelling correction can be disabled on demand as well as exact keyword search
  • Man page includes example search queries, shell completion scripts..
  • Returns the number of results
  • Users have the possibility to display first search result in a web browser
  • Allows users to start a query at a specific result number
  • Google-search keywords supported, for instance site:somesite.com, filetype:mimed etc

Prerequisite

Since Googler is based on Python, you would need to make sure that you already have python version 3.3 or higher. Use the command below to know your current version of Python:

python3 –version

Googler Installation

In order to install Googler from source, make sure to download the latest version (3.9 at time of writing).

Run the commands below :

cd Downloads

wget -c https://github.com/jarun/googler/archive/v3.9.tar.gz

tar -xvf v3.9.tar.gz

You may want to read: How to use the Tar command in Linux to compress and extract files

cd googler-3.9

sudo make install

In case you have received the error above, you would need to install the make command as follows :

sudo apt-get install –reinstall make

Now we try again the command below :

sudo make install

cd auto-completion/bash/

sudo cp googler-completion.bash /etc/bash_completion.d/

Using Googler

Once Googler is installed, You can start to perform some basic Google searches from your terminal. For instance, the command below will display information about net2.com:

Google terminal

In the example below, we will search for the quoted words “monitoring tools guide” in net2.com :

The command above used the following options:

  1. -n num – displays 8 results per page (default is 10)
  2. -w – Google site (net2.com) search

At the end of the search query, you may have noticed the omni-prompt below . Enter a question mark to view the description of each switch :

If you want to search for the latest news about a given subject, simply type in the below command and hit
enter :

Googler – N space missions          [Google search Ubuntu]     

Google search linux

You can search an alias for a specific search using the command below :

alias spacemissions=’googler -n 4 space missions’

spacemissions

How to open google in linux terminal

Conclusion

Googler is a powerful tool that can perfectly mimic standard Google search. This functionality can be used for instance by developers to create a customized light browser which is Google based or for those who want to build a search engine or a website statistics application…the options are limitless…

For more information about Googler, Visit the Googler Github repository or check the Googler man page.


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

amin nahdy

Amin Nahdy, an aspiring software engineer and a computer geek by nature as well as an avid Ubuntu and open source user. He is interested in information technology especially Linux based ecosystem as well as Windows and MacOS. He loves to share and disseminate knowledge to others in a transparent and responsible way.

This Post Has 2 Comments

    1. Interesting – will check it out – thanks.

Leave a Reply

Close Menu