The sys admin's daily grind
Charly's Column – googler
If you are a genuine admin, you will want to be able to google things at the command line. Charly uses googler for this; it has pretty useful capabilities despite the unimaginative name.
What if you need to google something but only have access to a command line? You could just grab your smartphone, but if you want to copy and paste something from the search results, that's not really a good solution. A text-mode browser like Lynx is more suitable.
But there is another option that is more powerful and fits seamlessly into the workflow on the console: googler
[1]. Many distributions have the tool in their package repositories, but it can also be installed manually with a few commands (Listing 1). The current version (at press time in July 2021) is googler
4.3.2.
Listing 1
Installing googler
$ cd Downloads/ $ wget -c https://github.com/jarun/googler/archive/refs/tags/v4.3.2.tar.gz $ tar -xvf v4.3.2.tar.gz $ cd googler-4.3.2/ $ sudo make install $ cd auto-completion/bash/ $ sudo cp googler-completion.bash /etc/bash_completion.d/
In the simplest case, you can start a keyword search on Google by calling googler TERM
. The result for the keyword "Linux" is shown in Figure 1. You can see that googler
numbers the search results. If you type the number for a search result, googler
passes the address to the default web browser to open. If this does not work for you, that means that googler
cannot determine the appropriate browser. You then need to pass in the name of the program with the --url-handler
parameters, for example, as --url-handler lynx
(or whatever you use).
By default, googler
always returns 10 search results; the number can be increased or reduced with the -n NUMBER
parameter. The parameter I use most often, however, is -t 12m
. This will only show hits that are at most 12 months old – which is quite handy, because if you're looking for a particular error message, for example, you are naturally more interested in recent results than ancient ones.
It is also often useful to limit the search to one website. For example, if you only want to see results from Wikipedia, you can do this with the -w
option. The example in Figure 2 shows hits for the term "Linux" that come from the Wikipedia website.
If you do not want to leave any data traces when searching the web, take a look at ddgr
[2]. It comes from the same author as googler
, supports (almost) the same parameters, but uses DuckDuckGo and is therefore far more frugal in terms of data handling.
Infos
- googler: https://github.com/jarun/googler
- ddgr: https://github.com/jarun/ddgr
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.