There are times when you are working on a headless Linux system (one with no GUI). What if you need to search something on Google in that setup? You may ask, is there a way to perform Google searches through the command line? Well, you'll be glad to know the answer is YES.
There exists a third-party command line tool dubbed Googler that does the trick. In this tutorial we will quickly discuss how this utility works. Please note that all commands and instructions mentioned here have been tested on Ubuntu 16.04LTS.
Search Google via command line using Googler
The tool not only allows you to search the Web, but also perform similar operation on Google News and Google Site Search from the command line. Here's how you can install it:
First download the Googler deb package from here, and then you can easily launch it in the following way:
You'll then be asked to initiate a query, something which you can do by entering a keyword or a line. For example, I entered the keyword 'faqforge'.
And as the above screenshot confirms, the tool produced Google search results for the keyword in the terminal window. Following is what the official documentation says about Googler:
It shows the title, URL and abstract for each result, which can be directly opened in a browser from the terminal. Results are fetched in pages (with page navigation).
Here are some of the tool's main features:
- Google Search, Google Site Search, Google News
- Fast and clean (no ads, stray URLs or clutter), custom color
- Navigate result pages from omniprompt, open URLs in browser
- Effortless keyword-based site search with googler @t add-on
- Search and option completion scripts for Bash, Zsh and Fish
- Fetch n results in a go, start at the nth result
- Disable automatic spelling correction and search exact keywords
- Specify duration, country/domain (default: worldwide/.com), language
- Google keywords (e.g. filetype:mime, site:somesite.com) support
- Open the first result directly in browser (as in I'm Feeling Lucky)
- Non-stop searches: fire new searches at omniprompt without exiting
- HTTPS proxy, User Agent, TLS 1.2 (default) support
- Comprehensive documentation, man page with handy usage examples
- Minimal dependencies
The tool provides a plethora of features. For specific details, head to the utility's GitHub page.