s: Web search from the terminal


s: Web search from the terminal

s is a lightweight command-line tool to perform web searches directly from your shell. It can use different providers, list them, and even run searches with a custom binary.

Quick start

  • Basic search (default provider):
s linux
  • List all providers:
s -l
  • Search with a specific provider (e.g., Google):
s -p google linux
  • Use a custom binary to perform the search query:
s -b "bash -lc" "linux"  # example with a shell command as the binary

Note: The -b/—binary option expects a command template like “{{binary}} {{arguments}}” and then the {{query}}. In practice, you typically provide a binary that can fetch or display results for the query.

Providers

  • s -l shows available providers and their identifiers.
  • To switch providers, pass -p with the provider name or slug from the list.

Example providers you might see: google, bing, duckduckgo, and more depending on your config.

Using a provider with a query

  • Structure: s {{[-p|—provider]}} {{provider}} {{query}}
  • Example: search for “linux basics” using DuckDuckGo:
s --provider duckduckgo "linux basics"

Advanced: combining with a custom binary

  • The -b option lets you specify a binary to perform the search query. This is useful if you have a terminal browser or a custom fetcher.
  • Example with a simple pager:
s -b "lynx -source" "sv"  # hypothetical usage; replace with a real binary if you have one

Be mindful that the exact binary and arguments depend on your system and installed tools.

Common pitfalls

  • Not escaping special characters in the query may lead to shell interpretation issues. Quote your query:
s "networking basics"
  • If a provider is down or blocked by your network, the search may fail. Try another provider with -l to pick a different one.
  • The -b option requires a compatible binary. If in doubt, omit -b and rely on the built-in web lookup.

Practical tips

  • Always start with s -l to understand which providers you can use on your system.
  • Use quoting around multi-word queries to avoid shell whitespace splitting.
  • Use -p to pin a provider if you regularly search with the same engine.

Troubleshooting

  • No results or command not found: ensure s is installed and in your PATH. Install from your package manager or via the project page.
  • Provider errors: try a different provider or update the cache if the tool uses cached results.

Summary

s brings web search power to the terminal, with simple commands to switch providers, run with a specific binary, and perform quick queries. Start with s linux, then explore -l, -p, and -b to tailor searches to your workflow.

See Also