:mag: Google from the terminal
googler is a power tool to Google (web, news, videos and site search) from the command-line. 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). Supports sequential searches in a single googler instance.
googler was initially written to cater to headless servers without X. You can integrate it with a text-based browser. However, it has grown into a very handy and flexible utility that delivers much more. For example, fetch any number of results or start anywhere, limit search by any duration, define aliases to google search any number of websites, switch domains easily... all of this in a very clean interface without ads or stray URLs. The shell completion scripts make sure you don't need to remember any options.
googler isn't affiliated to Google in any way.
Here are some usage examples:
Google hello world:
$ googler hello world
Fetch 15 results updated within the last 14 months, starting from the 3rd result for the keywords jungle book in site imdb.com:
$ googler -n 15 -s 3 -t m14 -w imdb.com jungle bookOr instead of the last 14 months, look for results specifically between Apr 4, 2016 and Dec 31, 2016:
$ googler -n 15 -s 3 --from 04/04/2016 --to 12/31/2016 -w imdb.com jungle book
Read recent news on gadgets:
$ googler -N gadgets
Fetch results on IPL cricket from Google India server in English:
$ googler -c in -l en IPL cricket
Search for videos on PyCon 2020:
$ googler -V PyCon 2020
Search quoted text:
$ googler it\'s a \"beautiful world\" in spring
Search for a specific file type:
$ googler instrumental filetype:mp3
Disable automatic spelling correction, e.g. fetch results for googler instead of google:
$ googler -x googler
I'm feeling lucky search:
$ googler -j leather jackets
Website specific search:
$ googler -w amazon.com -w ebay.com digital cameraSite specific search continues at omniprompt.
Positional arguments are joined (with delimiting whitespace) to form the final query, so you can be creative with your aliases. For instance, always exclude seoarticlefactory.com from search results:
$ alias googler='googler " -site:seoarticlefactory.com"'
$ googler '<hugely popular keyword filled with SEO garbage>'
Alias to find definitions of words:
alias define='googler -n 2 define'
Look up n, p, o, O, q, g keywords or a result index at the omniprompt: as the omniprompt recognizes these keys or index strings as commands, you need to prefix them with g, e.g.,
g n
g g keywords
g 1
Input and output redirection:
$ googler -C hello world < input > output
Note that -C is required to avoid printing control characters (for colored output).
Pipe output:
$ googler -C hello world | tee output
Use a custom color scheme, e.g., a warm color scheme designed for Solarized Dark (screenshot):
$ googler --colors bjdxxy google
$ GOOGLER_COLORS=bjdxxy googler google
Tunnel traffic through an HTTPS proxy, e.g., a local Privoxy instance listening on port 8118:
$ googler --proxy localhost:8118 googleBy default the environment variable https_proxy is used, if defined.
Quote multiple search keywords to auto-complete (using completion script):
$ googler 'hello w<TAB>
More help:
$ googler -h
$ man googlerMore fun stuff you can try with googler:
filetype:mime, site:somesite.com) supportgoogler requires Python 3.6 or later. Only the latest patch release of each minor version is supported.
To copy url to clipboard at the omniprompt, googler looks for xsel or xclip or termux-clipboard-set (in the same order) on Linux, pbcopy (default installed) on macOS and clip (default installed) on Windows. It also supports GNU Screen and tmux copy-paste buffers in the absence of X11.
Install googler from your package manager. If the version available is dated try an alternative installation method.
● Snap Store (snap install googler)
googler v2.7 and later ships with an in-place self-upgrade mechanism which you may want to disable. To do this, run
$ make disable-self-upgradebefore installation.
Packages for Arch Linux, CentOS, Debian, Fedora, openSUSE and Ubuntu are available with the latest stable release.
If you have git installed, clone this repository. Otherwise download the latest stable release or development version.
To install to the default location (/usr/local):
$ sudo make installTo remove googler and associated docs, run
$ sudo make uninstallPREFIX is supported, in case you want to install to a different location.
googler is a standalone executable (and can run even on environments like Termux). From the containing directory:
$ ./googlergoogler is a single standalone script, so you could download just a single file if you'd like to.
To install the latest stable version, run
$ sudo curl -o /usr/local/bin/googler https://raw.githubusercontent.com/jarun/googler/v4.3.2/googler && sudo chmod +x /usr/local/bin/googlerYou could then let googler upgrade itself by running
$ sudo googler -uSimilarly, if you want to install from git master (risky), run
$ sudo curl -o /usr/local/bin/googler https://raw.githubusercontent.com/jarun/googler/master/googler && sudo chmod +x /usr/local/bin/googlerand upgrade by running
$ sudo googler -u --include-gitSearch keyword and option completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of auto-completion/. Please refer to your shell's manual for installation instructions.
…googler doesn't have any! This is to retain the speed of the utility and avoid OS-specific differences. Users can enjoy the advantages of config files using aliases (with the exception of the color scheme, which can be additionally customized through an environment variable; see Colors). There's no need to memorize options.
For example, the following alias for bash/zsh/ksh/etc.
alias g='googler -n 7 -c ru -l ru'fetches 7 results from the Google Russia server, with preference towards results in Russian.
The alias serves both the purposes of using config files:
g, it expands to the preferred settings.argparse works, googler is written so that the settings in alias are completely overridden by any options passed from cli. So when the same user runs g -l de -c de -n 12 hello world, 12 results are returned from the Google Germany server, with preference towards results in German.googler @t is a convenient add-on to Google Site Search with unique keywords. While googler has an integrated option to search a site, we simplified it further with aliases. The file googler_at contains a list of website search aliases. To source it, run:
$ source googler_at
or,
$ . googler_at
With googler @t, here's how you search Wikipedia for hexspeak:
$ @w hexspeak
Oh yes! You can combine other googler options too! To make life easier, you can also configure your shell to source the file when it starts.
All the aliases start with the @ symbol (hence the name googler @t) and there is minimum chance they will conflict with any shell commands. Feel free to add your own aliases to the file and contribute back the interesting ones.
googler works out of the box with several text-based browsers if the BROWSER environment variable is set. For instance,
$ export BROWSER=w3mor for one-time use,
$ BROWSER=w3m googler queryDue to certain graphical browsers spewing messages to the console, googler suppresses browser output by default unless BROWSER is set to one of the known text-based browsers: currently elinks, links, lynx, w3m or www-browser. If you use a different text-based browser, you will need to explicitly enable browser output with the --show-browser-logs option. If you believe your browser is popular enough, please submit an
No open issues yet, or sync has not completed.