surfraw
Search the web via shell shortcuts
TLDR
Display the list of supported website search scripts (elvi)
Open the elvi's results page for a specific search in the browser
Display an elvi description and its specific options
Search using an elvi with specific options and open the results page in the browser
Display the URL to the elvi's results page for a specific search
Search using the alias
SYNOPSIS
surfraw [OPTIONS] <ELVI> [KEYWORDS...]
PARAMETERS
-browser <browser>
Specify the web browser to use (e.g., firefox, chromium, lynx, w3m). This overrides the default browser set by environment variables.
-text-browser
Force surfraw to use a text-based web browser, ignoring any default graphical browser settings.
-graphical-browser
Force surfraw to use a graphical web browser, ignoring any default text-based browser settings.
-q, --quick
Perform a quick search without prompting for additional options, if the selected ELVI supports it. Useful for non-interactive use.
-u, --unsafe
Allow unsafe (non-URL-encoded) characters in the query string. Use with caution, as it may break some searches.
-w, --url
Print the generated URL to standard output instead of opening a web browser. Useful for debugging or scripting.
-elvi
List all available Surfraw ELVIs (search engines/modules) that can be used.
-elvi-info <elvi>
Display detailed information about a specific ELVI, including its usage and supported options.
-dmenu
Use dmenu (or a similar tool) to interactively select an ELVI from a list. Requires dmenu to be installed.
-h, --help
Display a brief usage message and exit.
-v, --version
Display version information about surfraw and exit.
DESCRIPTION
Surfraw (Surf Raw Access to the Web) is a powerful collection of shell scripts designed to provide a quick and efficient way to query various online services directly from your terminal. It acts as a front-end to a wide range of search engines, encyclopedias, news sites, and other web resources, allowing users to perform searches without manually opening a browser and navigating to a search page.
When you invoke surfraw with a specific "elvi" (Surfraw ELVIs are its search engines/modules), it constructs the appropriate URL and then opens it in your preferred web browser (graphical or text-based). This makes it ideal for rapid information retrieval, scripting, and for users who prefer a command-line centric workflow. It supports hundreds of "elvi" out-of-the-box, from popular search engines like Google and DuckDuckGo to specialized sites like Wikipedia, IMDb, and various package managers.
CAVEATS
Surfraw requires a web browser (graphical or text-based) to be installed and configured on your system. Its functionality depends on the stability of the target websites' URL structures; changes on the website's side might break an ELVI. Configuration often involves setting environment variables or editing shell scripts.
ELVIS (EXTERNAL LINKS, VIA INTERFACING)
The core strength of Surfraw lies in its 'elvi', which are modular shell scripts, each designed to interface with a specific online service (e.g., Google, Wikipedia, IMDb). Users can easily discover existing elvi using surfraw -elvi or create custom ones to extend functionality to any web service that uses predictable URL patterns for searches.
CONFIGURATION
Surfraw's behavior can be extensively customized. Users can set default browsers, preferred ELVIs, and other options through environment variables (like SR_BROWSER, SR_TEXT_BROWSER, SR_GRAPHICAL_BROWSER) or by creating a personal configuration file (typically ~/.surfrawrc or ~/.config/surfraw/conf), which allows for persistent settings across sessions.
HISTORY
Surfraw was originally created by Greg Ward in 2000, aiming to provide a lightweight and fast command-line interface to web search engines. Its design emphasized extensibility through "elvi" (External Links, Via Interfacing), which are individual scripts for each search resource. Over the years, it has been actively maintained and expanded by a community of contributors, incorporating new search engines and improving functionality, making it a staple for command-line power users.