How To Search The Web From Terminal
A while ago, we wrote about Surfraw, a commandline interface to popular search engines and 100+ websites. Surfraw helps you to search for anything from Internet from Terminal. Today, I stumbled upon a similar utility named “S”. Yes, the name of this utility is “S”. Like Surfraw, the “S” utility also helps you to search the web from terminal. Let us be clear that neither “Surfraw” nor “S” are search engines. Both are just just command line interfaces. They still require a browser application for searching the Internet.
We can do the search either using search engines like Google, DuckDuckGo or directly search through a website such as Wikipedia, Arch Wiki, CNN, BBC, Soundcloud, And Youtube etc. All from Terminal. It will open the search results in your default web browser. “S” currently supports the following search engines and websites.
I hope the developers will add more sites in future.
The “S” utility can either installed using “Go” or “Linuxbrew”.
Make sure you have installed Go on your system. Refer the following link to install Go on Linux.
After installing “Go”, run the following commands one by one to install “S”.
$ go get -v github.com/zquestz/s $ cd $GOPATH/src/github.com/zquestz/s $ make $ sudo make install
Alternatively, you can install it using “Linuxbrew” package manager. First, install “Linuxbrew” on your system as described below.
After installing Linuxbrew, run this command to install “S”.
$ brew install s-search
Search The Web From Terminal
Type “s” without quotes to see list of available options and general usage.
$ s Web search from the terminal. Usage: s <query> [flags] Flags: -b, --binary string binary to launch search URI -c, --cert string path to cert.pem for TLS -h, --help help for s -k, --key string path to key.pem for TLS -l, --list-providers list supported providers --list-tags list available tags -o, --output output only mode --port int server port (default 8080) -p, --provider string search provider (default "google") -s, --server launch web server -t, --tag string search tag -v, --verbose verbose mode --version display version
Let us see some examples.
Let us search the web with search term – “ostechnix”.
$ s ostechnix
This command will open your default browser and search the given search string. By default, S uses Google as default search engine. You can change it to some other search engine, for example DuckDuckGo, using “-p” flag like below.
$ s -p duckduckgo ostechnix
Here, -p indicates provider (i.e website).
To search an item in Amazon, we use:
$ s -p amazon zero to one
The above command will open amazon.com and search for the book “Zero to One”. It’s that simple.
- Search Amazon Products From Command line
- Search Torrents From Command Line In LInux
- How To Search The Arch Wiki Website From Commandline
- Search And Browse Stack Overflow Website From Commandline
To search something on Wikipedia, we use:
$ s -p wikipedia linux
Now you can read about Linux on Wikipedia.
To search a topic on Subreddit, we use:
$ s -p reddit /r/archlinux aur helpers
To search topic on Quora website, we use:
$ s -p quora deep learning
How about a video on Youtube? That’s also possible. The following command will open videos related to APJ Abdul Kalam on Youtube.
$ s -p youtube Abdul Kalam
To list all providers (websites), run:
$ s -l
We can search the web using specific tags. For example, the following command topics that contains string “trending” on facebook.
$ s -p fa trending
To view list of available tags, run:
$ s --list-tags
Search on different browser
S uses your system’s default browser for web searching. You can change it to something else such as Chromium/Firefox as well.
To search the web on a browser other than your default one, we use -b flag.
To search the web using Chromium browser, run:
$ s -b "chromium" machine learning
To search the web with Firefox, use:
$ s -b "firefox" machine learning
You can also do incognito search like below.
$ s -b "chromium --incognito" artificial intelligence
$ s -b "firefox --private-window" artificial intelligence
For more details, refer the project’s GitHub repository given at the end of this guide.
And, that’s for now. Hope this was useful. More good stuffs to come. Stay tuned!
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!