Everyone knows how to google from a web browser, but an ambitious computer geek loves to shine in his or her terminal. Passion and dedication for computer systems exceed everything, the sky is the limit. Don't you believe me? Believes that you are on your server without graphic environment and you need to verify an error message which appears. You don't have a computer client to search on the web-browser and to "ssh your server", so you need absolutely a solution to do research directly on the server. You need a magic solution and we will give you a way to follow.
In this article, I will teach you how to use google from the terminal. But first, let me tell what do we need in order to do this geeky experiment. We need the following:
- An Ubuntu Linux
- A Terminal
- An Internet Connection
- w3m or googler
What is w3m? w3m is a World Wide Web (WWW) text based client which can be used to display html documents as well as a pager. I am sure that everyone who is reading this article and has knowledge about more or less tools understands what I am talking about when I say you can use the w3m tool as a pager.
Does w3m support images? Yes it does, but you can not view images in a Gnome Terminal or KDE Console, you need an Xterm terminal to display images while browsing with this amazing tool for computer geeks.
a. Install w3m
The following command will help us to install the World Wide Web text based client in our Linux machine.
On Debian, Mint, Ubuntu you can do
# apt-get install w3m w3m-img
b. Google From Terminal
After the installation is finished, run the following command to use google from the terminal. Note: Use the arrow keys to navigate through links and boxes and type enter if you want to put text in a box.
# w3m www.google.com
Do you guys use gmail? The cool thing is that you can access your gmail account directly from the terminal via the w3m tool.
Hey, you binary geeks, I think it is time to read some articles from our site linoxide, but this time from the terminal. We don't need a web browser, we are linux geeks, we will use a good tool to reach our site from the terminal!
# w3m www.linoxide.com
Awesome! We can read linux article directly from the terminal.To be honest with you guys I am feeling very happy right now. Yesterday, while reading something about system administration my google chrome browser crashed and everything went white, I couldn't browse. But where there is a terminal, there is always a way. I wish a knew this tool before!
As you can see from the following screenshot, we are not able to view any image.
Xterm terminal can help us to display images and view them.
Ok geeks, one last thing! You can use the w3m tool with the
-M option for monochrome display. For more options read the man page.
# w3m -M www.linoxide.com
googler is a power tool to Google (Web & News) and Google 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
is developed using Python and can be found on its developer’s GitHub repository which isn't affiliated to Google in any way. It 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.
a. Install googler
Wee need to add the repo before installing it.
# add-apt-repository ppa:twodopeshaggy/jarun # apt-get update # apt-get install googler
Now that it's installed, you can verify the version
# googler -v 3.1
b. Search from terminal
You can search a website on google from your terminal
You can use
n command to fetch previous or next page. If you open your browser and go to google to view the result, you will have exactly the same thing.
You can do a particular research on a website. You will indicate words. It is also possible to define the limit of the result to display.
# googler -n 5 -w linoxide.com \"Advanced Linux\"
it is possible to filter the result only for the last days or months.
# googler -w linoxide.com -t d5 press w
There is a part of some options available with googler:
optional arguments: -s N, --start N start at the Nth result -n N, --count N show N results (default 10) -t dN, --time dN time limit search [h5 (5 hrs), d5 (5 days), w5 (5 weeks), m5 (5 months), y5 (5 years)] -w SITE, --site SITE search a site using Google -v, --version show program's version number and exit 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 g keywords new Google search for 'keywords' with original options should be used to search omniprompt keys and indices q, ^D, double Enter exit googler * other inputs issue a new search with original options
You can visit the github repository to have the latest release and if you need more information about googler command.
Now we are able to navigate over our terminal. This can help you if your browser doesn't work well and you need to continue your work.