Skip to main content

How To Google Search From Commandline Using Googler

Googler features

  • Google Search, Google Site Search, Google News, Google Videos.
  • Fast and clean interface with no ads or stray URLs.
  • Each search result can be opened from the omniprompt (i.e. the googler prompt), without re-running googler every time. Meaning – you can perform new searches without leaving googlr.
  • Open URLs in the default browser.
  • Integrate Googler in your Text-browser.
  • Open the first search result directly in the browser (as in “I’m feeling lucky” feature).
  • Fetch any number of results and the start at nth result.
  • Supports Google search keywords (Eg. site:ostechnix.com, filetype:pdf).
  • Safe search support (i.e. excluding adult sites).
  • HTTPS proxy, User Agent, TLS 1.2 (default) support.
  • Filter search results by duration, domain, country and language.
  • Switch from one Domain to another easily.
  • Define aliases to google search any number of websites.
  • You can disable automatic spelling correction to search for exact search terms.
  • Lightweight and requires minimal dependencies.
  • Free and open source!!


Install Googler On Linux

Googler can be installed in multiple ways. Make sure you have installed Python 3.5 or later. And xsel or xclip or termux-clipboard-set to copy URL into the clipboard. These packages are mostly comes pre-installed. Just in case if they are not installed already,, you can install them using your distribution’s package manager. For example on Debian and Ubuntu, the prerequisites can be installed using command:
$ sudo apt-get install python3.5 xsel xclip

1. Install latest Googler standalone version

This is the easiest and recommended way to install Googler on Unix-like operating systems.
Download the latest available Googler version:
$ sudo curl -o /usr/local/bin/googler https://raw.githubusercontent.com/jarun/googler/v4.0/googler
Make it executable:
$ sudo chmod +x /usr/local/bin/googler
Done!
You can update to the latest version at any time using command:
$ sudo googler -u. 

Basic Google Search using Googler

Open your Terminal and type “googler” followed by your search term.
For example, let me search for the term – “ostechnix“.
$ googler ostechnix
You will get results related to “ostechnix” keyword.
OPEN WEB PAGES IN BROWSER
As you can see in the above output, I got six results and each result has an index number (or prefix number). Just type the number and hit ENTER to open the respective page in your default web browser. For example, if you type number 3, the third page from the result will open in the browser. It is that simple!
NAVIGATE THROUGH SEARCH RESULTS
To go to the next set of search results, simply press the letter n. Similarly, you can go to previous set of results by pressing p. Memorize it like – n for next and p for previous. To go the first page of google search results instantly from any page, press f.
SEARCHING FOR NEW KEYWORDS
To search for a new keyword, you don’t have to exit and re-run googler. We can perform non-stop searches without exiting Googler. Just type the new keyword in the omniprompt (i.e. googler prompt) and hit ENTER.
search for new keyword googler
As you can see, I am searching for a new keyword – linux.
COPY URLS TO CLIPBOARD
We can copy a specific URL from the result to clipboard by pressing the letter c followed by the index number of the respective URL. Please mind the space between ‘c’ and the index number.
Example:
googler (? for help) c 3
Here, we use c for copy and 3 is the index number. Hence the third page from the search results will be copied to clipboard. Please remember – you must have installed any one of the following utilities to use this feature.
  • xclip
  • xsel
  • termux-clipboard-set

Exit Googler

To exit from Googler and return back to Terminal,
  • press q and hit ENTER,
  • or press ENTER twice,
  • or press Ctrl+d.
These search tips are just enough in most cases. If you’d like to some advanced google search tips, read on.

Some advanced Google search tips

Googler supports all google keyword functionalities to get exact and precise results quickly and easily. Here I have included some of advanced Google search tips that I use from time to time.
FILTER RESULTS BY WEBSITE (SITE-SPECIFIC SEARCH)
The following command will get you the results for the search term arch linux from www.ostechnix.com blog only.
$ googler arch linux site:ostechnix.com
Or,
$ googler arch linux -w ostechnix.com
search on specific website using googler
See? I am getting the results only from ostechnix.com site.
LIST SIMILAR WEBSITES
This can be useful when you want to find all similar sites that shares a common niche.
$ googler related:www.ostechnix.com
SEARCH FOR QUOTED TEXT
At times you might want to search for some exact texts, for example song lyrics or quotes of a famous author. If so, just mention them inside quotes like below.
$ googler "You have to dream before the dream comes true"
SEARCH FOR SPECIFIC FILE TYPE
This tip will be useful when searching for a specific type of a file to download, for example a song, video, movie or text or pdf file.
$ googler blockchain filetype:pdf
The above command will fetch results related to Blockchain documents in pdf format.
FIND DEFINITIONS OF WORDS
Want to learn the definition of a word (Eg. acumen) from various online resources? Here you go!
$ googler define acumen
FETCH SPECIFIC NUMBER OF RESULTS
By default, Googler will display 10 results. You can change this behaviour using n flag like below. The following command will only fetch 3 resultsfor the given search query.
$ googler -n 3 ostechnix
Fetch specific number of results using googler
DISPLAY RESULTS STARTING FROM NTHRESULT
The following example will fetch the results starting from the 5th result for the keyword ostechnix:
$ googler -s 5 ostechnix
DISPLAY RESULTS WITHIN A SPECIFIC TIME SPAN
Fetch 10 results updated within the last 5 months, starting from the 3rd result for the keyword linux in ostechnix.com site:
$ googler -n 10 -s 3 -t m5 -w ostechnix.com linux
FETCH RESULTS FROM GOOGLE NEWS SECTION
The following command will fetch results related to “Arch linux” from news.google.com section.
$ googler -N Arch linux
FETCH COUNTRY-SPECIFIC RESULTS
You might have noticed that when you search something on google, you will get the results based on the country where you live. For example if you live in India, you will get results from Google India server.
If you want Googler to fetch search results exclusively from a certain country or region, use -c flag.
$ googler -c in best smartphone
This will return results from Google India server for best smartphone query.
FETCH LANGUAGE-SPECIFIC RESULTS
Like country-specific results, we can return language-specific results using -l flag.
$ googler -l ta arthashastra
This command will fetch results related to arthashatra including Tamil web pages.
DISABLE AUTOMATIC SPELLING CORRECTION
When we search specific terms, the Google will display the spelling suggestions (starting with a message Did you mean..), especially for technical and medical related search terms. If you want to disable this spell check feature, use -x flag.
$ googler -x googler
I’M FEELING LUCKY SEARCH
As you already know, the Google’s homepage includes a button labeled “I’m Feeling Lucky” below the search bar. When we type a search query and click this button, we will be taken directly to the first search result, bypassing the search engine results page.
Googler has an option to do this from command line. To perform “I’m Feeling Lucky” search, use -j flag followed by your search term as shown below.
$ googler -j browse web with vim keybindings
DISPLAY SITE INFORMATION
To get the information of a website/blog, run:
$ googler info:www.ostechnix.com
EXCLUDE ADULT WEBSITES FROM THE SEARCH RESULTS
To search for “sex education” material without returning adult sites, use:
$ googler safesearch:sex education
FETCH SEARCH RESULTS THAT CONTAINS A SPECIFIC TERM IN THE PAGE TITLE OR URL
$ googler allintitle:linux -w ostechnix.com
This will return all results that contains the word linux in the title from ostechnix.com.
Similarly, we can limit the results to those with all of the query words in the URL.
$ googler allinurl:linux -w ostechnix.com
PIPE SEARCH RESULTS TO A FILE
It is one of my favorite Google search tip. I have a habit of saving the results along with URLs in a text file when searching for a specific topic. This way I can refer the results later. To me, It is kind of offline bookmarking!
$ googler -C python | tee tutorial.txt
The above command will search for Python and save all the search results in a text file called tutorial.txt in the current working directory.

Simplify Google search with aliases

This feature is for the lazy users! Googler offers many website search aliases for many popular websites including Amazon, Arch Linux wiki, BBC, CNN, eBay, Facebook, Google search, GitHub, HackerNews, IMDB, LinkedIn, National Geographic, MIT OpenCourseWare, Python documentation, Quora, Reddit, Stack Overflow, Twitter, Ubuntu forums, Wikipedia and a lot more.
For example, to search something on Arch Wiki, simply run:
$ @aw install arch linux
Here, @aw is the alias for ArchWiki site. “install arch linux” is the keyword.
To enable this feature, download the googler @t add on and enable it like below.
$ wget https://raw.githubusercontent.com/jarun/googler/master/auto-completion/googler_at/googler_at
$ source googler_at
You can also add your own aliases. For example, I have created an alias named @ostech for ostechnix.com blog.
$ alias @ostech='googler -w ostechnix.com'
To search from ostechnix.com, I simply run:
$ @ostech dns
Add your aliases to ~/.bashrc file to make it permanent.
Refer the following guide to learn to use aliases in Linux.

Comments

Popular posts from this blog

How to use Ngx-Charts in Angular ?

Charts helps us to visualize large amount of data in an easy to understand and interactive way. This helps businesses to grow more by taking important decisions from the data. For example, e-commerce can have charts or reports for product sales, with various categories like product type, year, etc. In angular, we have various charting libraries to create charts.  Ngx-charts  is one of them. Check out the list of  best angular chart libraries .  In this article, we will see data visualization with ngx-charts and how to use ngx-charts in angular application ? We will see, How to install ngx-charts in angular ? Create a vertical bar chart Create a pie chart, advanced pie chart and pie chart grid Introduction ngx-charts  is an open-source and declarative charting framework for angular2+. It is maintained by  Swimlane . It is using Angular to render and animate the SVG elements with all of its binding and speed goodness and uses d3 for the excellent math functio...

Understand Angular’s forRoot and forChild

  forRoot   /   forChild   is a pattern for singleton services that most of us know from routing. Routing is actually the main use case for it and as it is not commonly used outside of it, I wouldn’t be surprised if most Angular developers haven’t given it a second thought. However, as the official Angular documentation puts it: “Understanding how  forRoot()  works to make sure a service is a singleton will inform your development at a deeper level.” So let’s go. Providers & Injectors Angular comes with a dependency injection (DI) mechanism. When a component depends on a service, you don’t manually create an instance of the service. You  inject  the service and the dependency injection system takes care of providing an instance. import { Component, OnInit } from '@angular/core'; import { TestService } from 'src/app/services/test.service'; @Component({ selector: 'app-test', templateUrl: './test.component.html', styleUrls: ['./test.compon...

How to solve Puppeteer TimeoutError: Navigation timeout of 30000 ms exceeded

During the automation of multiple tasks on my job and personal projects, i decided to move on  Puppeteer  instead of the old school PhantomJS. One of the most usual problems with pages that contain a lot of content, because of the ads, images etc. is the load time, an exception is thrown (specifically the TimeoutError) after a page takes more than 30000ms (30 seconds) to load totally. To solve this problem, you will have 2 options, either to increase this timeout in the configuration or remove it at all. Personally, i prefer to remove the limit as i know that the pages that i work with will end up loading someday. In this article, i'll explain you briefly 2 ways to bypass this limitation. A. Globally on the tab The option that i prefer, as i browse multiple pages in the same tab, is to remove the timeout limit on the tab that i use to browse. For example, to remove the limit you should add: await page . setDefaultNavigationTimeout ( 0 ) ;  COPY SNIPPET The setDefaultNav...