← All one-liners·#005·reference·self contained·beginner

Wikipedia article summary in 1 line

Pull the lead paragraph of any Wikipedia article. Faster than opening a browser tab.

The one-liner
$ curl -s "https://en.wikipedia.org/api/rest_v1/page/summary/Functional_programming" \
  | jq -r '.extract'
What each stage does
  1. [01] curlcurl -s "https://en.wikipedia.org/api/rest_v1/page/summary/Functional_programmin…
    Wikipedia's REST summary endpoint. The path is the article title with underscores. Returns title, description, .extract (lead paragraph), and thumbnail.
  2. [02] jqjq -r '.extract'
    Pluck the lead-paragraph string. -r outputs raw text (no surrounding quotes).
Expected output (sample)
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions...
Caveats & tips
  • Use the URL-safe title (spaces → underscores).
  • Swap `en` for `de`, `fr`, etc. for other languages.
  • Add `?redirect=true` to follow redirects.