How to use the command surfraw (with examples)
The Surfraw command is a tool that allows users to query various web search engines and view the results in their browser. It is a collection of elvi, each of which is capable of searching a specific website. Surfraw can be used to access the results pages of different search engines quickly and efficiently.
Use case 1: Display the list of supported website search scripts (elvi)
Code:
surfraw -elvi
Motivation: By displaying the list of supported website search scripts, users can easily see the available options for searching websites using Surfraw.
Explanation: -elvi
is a flag that is used to list all the website search scripts (elvi) supported by Surfraw.
Example output:
google
bing
yahoo
duckduckgo
Use case 2: Open the elvi’s results page for a specific search in the browser
Code:
surfraw elvi "search_terms"
Motivation: This use case allows users to directly open the search results page for a specific search term in their browser, making it convenient for quickly finding information.
Explanation: elvi
is the name of the specific search engine. "search_terms"
is the search term that will be used to query the search engine.
Example output: (The user’s default browser opens with the search results for the specified search terms.)
Use case 3: Display an elvi description and its specific options
Code:
surfraw elvi -local-help
Motivation: This use case allows users to get detailed information about a specific elvi and its available search options.
Explanation: elvi
is the name of the specific search engine. -local-help
is a flag that displays the description and specific options for the elvi.
Example output:
Elvi google
-abc-scores
-h
-compat
Use case 4: Search using an elvi with specific options and open the results page in the browser
Code:
surfraw elvi elvi_options "search_terms"
Motivation: By using specific options with an elvi, users can customize their search preferences and obtain more accurate results.
Explanation: elvi
is the name of the specific search engine. elvi_options
are the options that can be set for the elvi. "search_terms"
is the search term that will be used to query the search engine.
Example output: (The user’s default browser opens with the search results for the specified search terms using the specified options.)
Use case 5: Display the URL to the elvi’s results page for a specific search
Code:
surfraw -print elvi "search_terms"
Motivation: This use case allows users to obtain the URL of the search results page for a specific search, which can be useful for various purposes such as sharing the link.
Explanation: -print
is a flag that instructs Surfraw to only display the URL of the search results page. elvi
is the name of the specific search engine. "search_terms"
is the search term that will be used to query the search engine.
Example output:
https://www.google.com/search?q=search+terms
Use case 6: Search using the alias
Code:
sr elvi "search_terms"
Motivation: By using the alias sr
instead of the command surfraw
, users can save time and type fewer characters when executing Surfraw commands.
Explanation: sr
is the alias for the surfraw
command. elvi
is the name of the specific search engine. "search_terms"
is the search term that will be used to query the search engine.
Example output: (The user’s default browser opens with the search results for the specified search terms.)
Conclusion:
The Surfraw command provides a versatile and efficient way to query various search engines and view the results in the browser. With its support for specific search options and the ability to access search results pages directly, Surfraw offers users a streamlined and convenient search experience. Whether it’s searching on popular search engines or lesser-known websites, Surfraw enables users to quickly find the information they need.