How To Search The Web From Terminal

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.

  1. 500px
  2. 8tracks
  3. amazon
  4. archpkg
  5. archwiki
  6. arstechnica
  7. arxiv
  8. atmospherejs
  9. aur
  10. baidu
  11. bandcamp
  12. bgr
  13. bing
  14. buzzfeed
  15. cnn
  16. codepen
  17. coursera
  18. cplusplus
  19. cppreference
  20. crates
  21. crunchyroll
  22. debianpkg
  23. dict
  24. digg
  25. diigo
  26. dockerhub
  27. dribbble
  28. duckduckgo
  29. dumpert
  30. engadget
  31. explainshell
  32. facebook
  33. flickr
  34. flipkart
  35. foursquare
  36. gist
  37. github
  38. gmail
  39. go
  40. godoc
  41. goodreads
  42. google
  43. googledocs
  44. googleplus
  45. hackernews
  46. ietf
  47. ifttt
  48. imdb
  49. imgur
  50. inbox
  51. instagram
  52. kickasstorrents
  53. libgen
  54. linkedin
  55. lmgtfy
  56. macports
  57. mdn
  58. medium
  59. metacpan
  60. msdn
  61. naver
  62. netflix
  63. nhaccuatui
  64. npm
  65. npmsearch
  66. npr
  67. nvd
  68. overstock
  69. packagist
  70. phandroid
  71. php
  72. pinterest
  73. postgresql
  74. python
  75. quora
  76. reddit
  77. regex
  78. rottentomatoes
  79. rubygems
  80. shodan
  81. soundcloud
  82. spotify
  83. stackoverflow
  84. steam
  85. taobao
  86. thepiratebay
  87. theregister
  88. torrentz
  89. twitchtv
  90. twitter
  91. unity3d
  92. upcloud
  93. vimeo
  94. wikipedia
  95. wolframalpha
  96. yahoo
  97. yandex
  98. youtube
  99. zhihu

I hope the developers will 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

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!

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.