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 just "S". Like Surfraw, the "S" utility also helps you to search the web from terminal. Please note 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.

500px 8tracks amazon archpkg archwiki arstechnica arxiv atmospherejs aur baidu bandcamp bgr bing buzzfeed cnn codepen coursera cplusplus cppreference crates crunchyroll debianpkg dict digg diigo dockerhub dribbble duckduckgo dumpert engadget explainshell facebook flickr flipkart foursquare gist github gmail go godoc goodreads google googledocs googleplus hackernews ietf ifttt imdb imgur inbox instagram kickasstorrents libgen linkedin lmgtfy macports mdn medium metacpan msdn naver netflix nhaccuatui npm npmsearch npr nvd overstock packagist phandroid php pinterest postgresql python quora reddit regex rottentomatoes rubygems shodan soundcloud spotify stackoverflow steam taobao thepiratebay theregister torrentz twitchtv twitter unity3d upcloud vimeo wikipedia wolframalpha yahoo yandex youtube zhihu

Keep an eye on the project, the developers may add more sites in future.

Installing "S"

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.

Basic search

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.

Also read:

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

Use Tags

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.

Chromium:

$ s -b "chromium --incognito" artificial intelligence

Firefox:

$ s -b "firefox --private-window" artificial intelligence

Related read:

For more details, refer the project's GitHub repository given below.

Resource: