Introduction
Before we begin talking about how to Google Search From Command line using Googler, let's briefly understand – What is Googler?
The most popular search engine on the Web, as we are all aware, is Google Search.
With a market share of more than 70%, Google search remains the most popular search engine when compared to others like Baidu, DuckDuckGo, and Yandex, etc.
Google search has ingrained itself into both our personal and professional life. Everybody is familiar with the Google search process while using a graphical web browser.
Googler is a Linux and Unix command-line utility for searching Google from the Terminal. Googler displays the title, URL, and abstract for each result in a clean interface free of advertising and stray URLs.
Googler allows you to harness the power of Google Search right from your command line interface. With Googler, you can swiftly access search results, view cached pages, and even grab URLs, all without the need for a web browser.
In this tutorial, you will Google Search From Command line Using Googler. We will also address a few FAQs on how to Google Search From Command line Using Googler.
Googler features
- Google News, Google Videos, Google Search, and Google Site Search.
- The user interface is quick and free of advertisements and stray URLs.
- Without having to run Googler again, each search result can be opened from the omni prompt (also known as the Googler prompt). In other words, you can conduct new searches without leaving googlr.
- Open URLs using the default browser.
- Integrate Googler into your text browser.
- Directly open the first search result in the browser (similar to the "I'm feeling lucky" option).
- Start with the nth result and fetch any number of results.
- Supports keywords for Google searches, such as site:ostechnix.com and filetype:pdf.
- Support for safe searches (i.e., omitting pornographic websites).
- User Agent, HTTPS proxy, and TLS 1.2 (by default) support.
- Search results can be filtered by duration, domain, nation, and language.
- Easily change from one domain to another.
- To use Google to search any number of domains, define aliases.
- You can turn off automated spelling check so that you can search using precise terms.
- minimal dependencies and lightweight.
- Free and open-source software
Install Googler On Linux
Googler can be set up in a variety of ways.
To copy a URL to the clipboard, you need Python 3.5 or later with either xsel, xclip, or termux-clipboard-set.
You can install them using your distribution's package manager, just in case they aren't already. For instance, the prerequisites can be installed using the following command on Debian and Ubuntu:
sudo apt-get install python3.5 xsel xclip
1. Install the newest Googler standalone version
The simplest and preferred method for installing Googler on Unix-like operating systems is as described above.
Download the most recent version of Googler:
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
All done!
You can always use the following command to upgrade to the most recent version:
sudo googler -u
2. Install Googler from source
Make sure your Linux computer has development tools installed before attempting to install Googler by issuing the following commands one at a time.
git clone https://github.com/jarun/googler.git
cd googler/
sudo make install
cd auto-completion/bash/
sudo cp googler-completion.bash /etc/bash_completion.d/
3. Install Googler using package manager
For many well-known Linux distributions, Googler has been packaged. Install Googler from your distribution's repositories if you want a stable version.
Install Googler via the AUR using any AUR like Paru or Yay on Arch Linux and its variations.
paru -S googler
or,
yay -S googler
On DEB-based systems like Debian, Ubuntu, Linux Mint, Pop OS, and others:
sudo apt install googler
On Fedora:
sudo dnf install googler
On CentOS 8:
sudo dnf install epel-release
sudo dnf install googler
On openSUSE Leap/Tumbleweed:
sudo zypper install googler
4. Download and Install Googler binary packages
Additionally, Googler is accessible for other Linux distributions as binary packages. Simply download the most recent version from the releases page and install it using the package manager provided by your distribution. Please be aware that all necessary dependencies must be installed.
For instance, you can install Googler as shown below on DEB-based systems.
wget https://github.com/jarun/googler/releases/download/v4.0/googler_4.0-1_ubuntu18.04.amd64.deb
sudo dpkg -i googler_4.0-1_ubuntu18.04.amd64.deb
sudo apt-get install -f
On RPM-based systems:
wget https://github.com/jarun/googler/releases/download/v4.0/googler-4.0-1.el7.6.centos.x86_64.rpm
sudo rpm -ivh googler-4.0-1.el7.6.centos.x86_64.rpm
Refer to the official GitHub page listed at the end for other installation methods.
Google search from command line using Googler
Some of you might not be familiar with the more sophisticated Google search techniques, such as searching solely on a particular website, searching for a specific file type, searching across ranges of numbers, etc.
But everyone is capable of performing a basic Google search. Simply enter your search word in the Google search window and select an appropriate result from the list. It is extremely simple!
Let's now examine how to use Googler to conduct a command-line search on Google. Trust me, it's also really simple!
Basic Google search using Googler
Open your Terminal and enter your search phrase after "googler".
Let me run a search for the phrase "redhat" as an example.
googler redhat
Results relating to the keyboard "redhat" will be shown.
Open web pages in browser
As you can see from the output above, I received six results, and each one has a prefix or index number. To open the corresponding page on your usual web browser, simply type the number and press ENTER. If you type the number 3
, for instance, the third page of the results will appear in the browser. That's how easy it is!
Navigate through search results
Just press the letter n
to move to the following set of search results. Similarly, hitting p
will take you to the previous set of results. Put it in your memory as n
for next and p
for previous. Press f
to rapidly navigate to the first page of Google search results from any page.
Searching for new keywords
There is no need to quit and restart the googler to look for another keyword.
Without leaving Googler, we are able to conduct endless searches. Simply enter the new keyword in the omniprompt (also known as googler prompt).
As you can see, we are looking for the keyword "linux" in my search.
Copy URLs to clipboard
By hitting the letter C and the relevant URL's index number, we can copy a specific URL from the result to the clipboard. Remember to provide a space between the index number and the letter 'c
'.
Example:
googler (? for help) c 3
Here, the index number is 3
, and we use the copy command (c
). The third page of the search results will therefore be copied to the clipboard. Please keep in mind that in order to utilize this function, you must have installed at least one of the following tools.
- xclip
- xsel
- termux-clipboard-set
Exit Googler
To leave Googler and head back to the terminal,
- press q and hit ENTER,
- or press ENTER twice,
- or press Ctrl+d.
In most circumstances, these search tips will suffice. Read on for more advanced Google search tips.
Some advanced Google search tips
To obtain accurate and precise results fast and easily, Googler supports all Google keyword functions. We have provided some in-depth Google search advice here that we occasionally utilize.
Filter results by website (Site-specific search)
You can only access the blog posts from ostechnix.com using the search term arch linux and the command that follows.
googler arch linux site:ostechnix.com
Or,
googler arch linux -w ostechnix.com
See? Only the ostechnix.com website is where I am receiving the findings.
List similar websites
When you want to identify all similar websites that have a similar niche, this can be helpful.
googler related:ostechnix.com
Search for quoted text
You might occasionally want to look for certain materials, such music lyrics or author quotes. If so, simply put them in quotations, like below.
googler "You have to dream before the dream comes true"
Search for specific file type
This advice is helpful when looking for a certain kind of item to download, such as a song, video, film, text, or PDF file.
googler blockchain filetype:pdf
The aforementioned command will retrieve documents connected to the blockchain in pdf format.
Find definitions of words
Do you want to research several web resources to find the definition of a word (like acumen)? You're all set!
googler define acumen
Googler displays 10 results by default. Using the n
flag as shown below, you can alter this behaviour. Only 3 results will be returned by the next command for the specified search.
googler -n 3 ostechnix
Display results starting from nth result
For the keyword ostechnix, the example below will retrieve results beginning with the 5th result:
googler -s 5 ostechnix
Display results within a specific time span
Starting with the third result for the keyword "linux" on the ostechnix.com website, fetch 10 results that have been updated in the last five months:
googler -n 10 -s 3 -t m5 -w ostechnix.com linux
Fetch results from Google News section
The command below will retrieve information on "Arch linux" from the news.google.com section.
googler -N Arch linux
Fetch country-specific results
You may have observed that when you conduct a Google search, the results are determined by the nation in which you are located. For instance, the Google India server will deliver results if you reside in India.
Use the -c
flag to tell Google to only retrieve results from a particular nation or region.
googler -c in best smartphone
For the best smartphone question, this will return results from the Google India server.
Fetch language-specific results
Using the -l flag, we may provide results particular to a language, similar to results specific to a country.
googler -l ta arthashastra
The arthashatra-related search results from this command will include Tamil web pages.
Disable automatic spelling correction
Particularly for technical and medical search terms, Google will offer spelling recommendations when we enter specified terms (beginning with the message Did you mean..). Use the -x
flag to turn off the spell check feature.
googler -x googler
I'm feeling Lucky search
You are well aware that there is a "I'm Feeling Lucky" button on the Google homepage, just below the search bar. Bypassing the search engine results page, when we type a search query and click this button, we are sent immediately to the first search result.
There is a command line option for Googler to perform this. Use the -j
flag and your search query as shown below to run a "I'm Feeling Lucky" search.
googler -j browse web with vim keybindings
Display site information
Run the following command to retrieve information from a website or blog:
googler info:ostechnix.com
Use the following to find "sex education" content without being sent to adult websites:
googler safesearch:sex education
Retrieve search results that contains a specific term in the Page title or URL
googler allintitle:linux -w ostechnix.com
This will bring up every result from ostechnix.com whose title contains the word "linux."
Similarly, we can restrict the results to those whose URLs contain all the search phrases.
googler allinurl:linux -w ostechnix.com
Pipe search results to a file
One of my favourite Google search tips is this one. When I search for a certain topic, I have a tendency of saving the results along with URLs in a text file. I can later refer to the results in this manner. It seems to me to be a form of offline bookmarking!
googler -C python | tee tutorial.txt
With the aforementioned command, all Python-related search results will be saved in a text file called tutorial.txt
in the current working directory.
Simplify Google search with aliases
Users that are lazy should use this feature! For many well-known websites, including Amazon, the Arch Linux wiki, the BBC, CNN, eBay, Facebook, Google, HackerNews, IMDB, LinkedIn, National Geographic, MIT OpenCourseWare, Python documentation, Quora, Reddit, Stack Overflow, Twitter, Ubuntu forums, Wikipedia, and many others, Googler provides a variety of website search aliases.
Run these commands, for instance, to perform a search on Arch Wiki:
@aw install arch linux
The site's alias, @aw, is used here. The vital keyword is "install arch linux".
Download the googler @t add on and activate it as shown below to enable this feature.
wget https://raw.githubusercontent.com/jarun/googler/master/auto-completion/googler_at/googler_at
source googler_at
Furthermore, you can add your own aliases. As an example, I made the alias @ostech for our ostechnix.com blog.
alias @ostech='googler -w ostechnix.com'
I simply use the following command to search from ostechnix.com:
@ostech dns
To make your aliases permanent, add them to the ~/.bashrc
file.
Integrate Googler with Text browsers
Several Text-browsers, such elinks, links, lynx, and w3m or www-browser, can be combined with Googler. As long as the BROWSER environment variable is properly configured, this will function right out of the box. For instance:
export BROWSER=w3m
For single use,
BROWSER=w3m googler dns
Or, conduct site-specific search:
BROWSER=w3m googler -w ostechnix.com arch linux
This command will find ostechnix.com for an arch linux query. Any link's index number will automatically open in the w3m browser when you type it and press the ENTER key.
Getting help
Run: to get a list of all supported options and their descriptions.
googler --help
Or, shortly:
googler -h
Additionally, you can read the instant assistance section by pressing the ?
(question mark):
googler (? for help) ?
omniprompt keys:
n, p fetch the next or previous set of search results
index open the result corresponding to index in browser
f jump to the first page
o [index|range|a ...] open space-separated result indices, numeric ranges
(sitelinks unsupported in ranges), or all, in browser
open the current search in browser, if no arguments
O [index|range|a ...] like key 'o', but try to open in a GUI browser
g keywords new Google search for 'keywords' with original options
should be used to search omniprompt keys and indices
c index copy url to clipboard
u toggle url expansion
q, ^D, double Enter exit googler
? show omniprompt help
* other inputs issue a new search with original options
FAQs to Google Search From Commandline Using Googler
How do I perform a search with Googler?
Simply open your terminal and enter the command "googler" followed by your search query. Googler will then fetch and display the relevant search results for you.
Can I view cached pages using Googler?
Yes, Googler provides the option to view cached pages. You can access the cached version of a webpage by selecting the corresponding option displayed in the search results.
Can I filter search results with Googler?
Absolutely! Googler allows you to apply various filters to your search results, such as specifying the time range, restricting the search to particular websites, or even excluding specific terms from the results.
Can I grab URLs directly with Googler?
Yes, Googler allows you to extract URLs from the search results. You can copy the URL of a specific search result by selecting the corresponding option provided by Googler.
Is Googler only limited to web search?
No, Googler can perform a wide range of functions beyond web search. It can display news, perform calculations, check the weather, and even show maps and currency conversions.
Can I customize the appearance of Googler's output?
Absolutely! Googler provides various customization options, such as adjusting the number of search results displayed per page or changing the color scheme, allowing you to tailor the output according to your preferences.
Is Googler an official Google product?
No, Googler is not an official Google product. It is an open-source tool developed by an individual contributor and is not affiliated with Google.
Conclusion
In this tutorial, you learned how to install and use Googler from command line in Linux and Unix-like operating systems. If you have any queries or doubts, please leave them in the comment below. We'll be happy to address them.