Command-line search engine


© Lead Image © Andrea Danti,

© Lead Image © Andrea Danti,

Article from Issue 202/2017

With a few customizations, Googler plus a text-based browser offers faster, more accurate searching than a traditional web browser.

These days, doing a web search from the command line may seem like an anachronism. However, Googler [1] can be useful in a number of ways. It provides a headless search engine that can be called within a script. When combined with a text-based browser, it gives you access to the Internet. Most important of all, Googler offers the same search options and presentation of results as the Google home page, but with the use of a few aliases, in fewer keystrokes.

Googler is available in many distributions and runs in the most common command shells. However, you can get the latest stable version by running the command googler -u as soon as you install. To obtain the latest, possibly unstable, version, you can add --include-git to the command as well. Alternatively, if the latest version seems more of a risk than you are willing to take, you can compile Googler yourself with the command:

make disable-self-upgrade

Additionally, if you plan on using Googler with a text-based browser, such as ELinks, Links, Lynx, or w3m, set the Browser environment variable with:


To use a text-based browser temporarily, enter:

BROWSER=[BROWSER] googler query


Googler uses the standard command structure COMMAND OPTIONS STRING. As in Google itself, the search string should be enclosed in double quotation marks (") when you want to search for an exact phrase. The majority of options are divided into two categories: search filters and customization of search results.

Search filters are similar to those available on the Google home page. The difference is that, while many search filters are available on Google only after you make the initial search, you can add search filters directly into the googler command and combine them more easily. Even if you are using googler without shortcuts (see below), the number of characters entered with googler is about equal to the number of clicks required on the Google home page, which means that a Googler search is somewhat faster once you have memorized the search filters.

As you filter a search, you probably want to begin with

--count=NUMBER (-n)

to set the number of results per page. (The entry in the parentheses is the short form of the option.) If you are previously familiar with the results, or you hope to sidestep Google's placement of personalized results at the top of the first page, you can specify the first result to display:

start=NUMBER (-s)

Using --count and --start together displays results starting with the one specified by --start. Other search filters include


to search in a specific version of Google – for example, for Canada rather than A two-character abbreviation is used for each country [2]. Similarly

--lang=LANGUAGE (-l)

returns only results in the language and locale specified using a two-character abbreviation for the language, separated from the two-character locale code – for example, en-uk is the English language as spoken in the United Kingdom [3]. In the same way,

--times= UNIT NUMBER (-t)

specifies how long ago the results were posted, with options for the units h (hours), d (days), w (weeks), m (months), and y (years); therefore, -t=w3 would look for results posted in the last three weeks.

Search filters can also be used to specify a site. The option

--news (-N)

specifically searches Google News, and

site=URL (-S)

searches only the defined site. You can also enter

--first (--lucky, -j)

to limit output to the first result found – the equivalent of the Google I'm Feeling Lucky button.

Another set of options specifies the colors used to display results (Figure 1). By default, six characters are used to define colors. In order, they represent the indices, titles, URLs, metadata (for searches in Google News), abstracts, and prompts. Each can be assigned a basic, bright, or bold color option (Table 1) using the option:

--colors= SIX LETTER STRING (-c)
Figure 1: The first two color-coded results of a search for the Gentium font.

Table 1

Color Options


















Bright versions of the regular colors above


Bold versions of the regular colors


Reverse normal colors


Reverse bold colors

To use a set of colors permanently, set the environment variable GOOGLER_COLORS. These codes are entered with:

--colors= SIX LETTER STRING (-c)

Normal colors (y) and bold colors (Y) can also reverse foreground and background. If you prefer to have no colors, use:

--nocolor (C)

Navigating Results

When results display, you can open a result in your default web browser by entering its number at the bottom of the list. Keyboard shortcuts – which Googler help refers to as "omniprompt keys" – are available to help you navigate through the list (Table 2). Selections open in the web browser, but you must return to the results to navigate.

Table 2

Googler Omniprompts


Next search result


Previous search result


Return to complete list of search results


Jump to the first page of results, if any


Move to indices, a range of results, or all results


Do a search for keywords within obtained results

q, ^D, double Enter

Exit Googler


Show omniprompt help


Start a new search using the original options


Unlike most applications, Googler does not have a configuration file. However, you can store preferences for items, such as text-based browsers and color schemes, to save typing.

Also, Googler has several ways of storing searches. None of these choices are necessary, but you might explore them to see which suits you.

To start, Googler has autocompletion files for bash [4], fish [5], and zsh [6]. Another option that is installed with Googler is the googler @t add-on, which includes the googler_at [7] configuration file of aliases.

googler_at contains hundreds of abbreviated aliases (Figure 2), ranging from social media sites like Facebook and the Linux Kernel Mailing List to resources such as the Debian package search page and the Ubuntu man pages. To use googler_at, enable it by entering the command:

source googler_at
Figure 2: googler_at comes with a file of ready-to-use aliases, to which you can also add your own.

Although the message displays that the file cannot be found, you can then use the file's aliases. For example, entering

@w debian

searches Wikipedia for references to Debian. You can add aliases using the standard alias command. For example, the command:

alias m='googler -n 20 -c en -l us'

returns results in pages of 20 in US English. These aliases require some memorization, but, for ones you use regularly, they can greatly increase Googler's speed. Just be sure that none of Googler's aliases conflict with ones that you have already made.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • FOSSPicks

    Sparkling gems and new releases from the world of Free and Open Source Software.

  • Welcome

    The eyes of the tech world are all on Google with the announcement that Google's Compute Engine cloud service is now open to the public. The new service is Google's answer to Amazon's AWS cloud system and is poised to capture some of the same customers. Many are predicting Compute Engine will be a game changer, as the sports addicts would say: a historic move that will change the whole landscape – and they might be right. If anyone has the power and personnel to take on Amazon, it is definitely Google, although it is worth remembering that, after striking it rich with search, Google's later attempts to swallow whole industries have not always been as successful as the experts predicted. (Anyone remember when Google Wave was supposed to take down Facebook?)

  • Ted Ts'o Joins Google and Helps with Ext4 Migration

    Formerly kernel and file system developer at the Linux Foundation, Theodore Ts'o has been working at Google since January. His first project: The migration of the file system ext4.

  • Perl – Video Preview

    Rather than stare at boring surveillance videos, in which nothing happens 90 percent of the time, Mike Schilli tries the OpenCV image recognition software, which automatically extracts the most exciting action sequences.

  • Min

    A simple design, efficient performance, and a built-in ad blocker are reasons for a closer look at the Min web browser.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95