ManKier API v2

Search for man pages, get information about them, or explain whole commands.

Search Man Pages

Search man pages starting with who:
https://www.mankier.com/api/v2/mans/?q=who

Resulting JSON, up to 20 entries:

{
  "q": "who",
  "truncated": false,
  "results": [
    {"name": "who", "section": "1", "description": "show who is logged on", "url": "https://www.mankier.com/1/who"},
    {"name": "who", "section": "1p", "description": "display who is on the system", "url": "https://www.mankier.com/1p/who"},
    {"name": "whom", "section": "1", "description": "report to whom a message would go"},
    ...
    {"name": "whois.jwhois", "section": "1", "description": "Alias of jwhois(1)", "url": "https://www.mankier.com/1/jwhois", "is_alias": true}
  ]
}
  

If a result is a command alias, it gets a "is_alias": true property, and the "url" property points to the command for which it is an alias.

Optional parameters:

Get Man Page Details

Get details for a man page:
https://www.mankier.com/api/v2/mans/ls.1

Result is JSON:

{
  "name": "ls",
  "section": "1",
  "description": "list directory contents",
  "url": "https://www.mankier.com/1/ls",
  "sections": [
    {
      "id": "Synopsis",
      "title": "Synopsis",
      "url": "https://www.mankier.com/1/ls#Synopsis"
    },
    {
      "id": "Description",
      "title": "Description",
      "url": "https://www.mankier.com/1/ls#Description",
      "sections": [
        {
          "id": "Description-Exit_status",
          "title": "Exit status",
          "url": "https://www.mankier.com/1/ls#Description-Exit_status"
        },
        ...
      ]
    },
    ...
  ],
  "anchors": [
    {
      "anchor": "<strong>-1</strong>",
      "description": "<p>list one file per line.  Avoid '\\n' with <strong>-q</strong> or <strong>-b</strong></p>",
      "url": "https://www.mankier.com/1/ls#-1"
    },
    {
      "anchor": "<strong>-a</strong>, <strong>--all</strong>",
      "description": "<p>do not ignore entries starting with .</p>",
      "url": "https://www.mankier.com/1/ls#-a"
    },
    ...
  ]
}

Anchors returned are the terms in definition lists on ManKier, their HTML strings corresponding to the original map page’s formatting.

Get a Man Page Section

Get the contents of a section in a man page:
https://www.mankier.com/api/v2/mans/ls.1/sections/Synopsis
(last thing in path is a section id - see Get Man Page Details.)

Result is JSON:

{
  "id": "Synopsis",
  "title": "Synopsis",
  "url": "https://www.mankier.com/1/ls#Synopsis",
  "html": "<section><h2>Synopsis</h2>\n<p><code><strong>ls</strong> [<em>OPTION</em>]... [<em>FILE</em>]...</code></p></section>"
}

This also works for subsections (sections within sections):
https://www.mankier.com/api/v2/mans/ls.1/sections/Description-Exit_status

Get Man Page References

Get all the connections from and to a man page, and also any connections between its connections:
https://www.mankier.com/api/v2/mesh/who.1

Result is JSON:

[
  {"f": "talk.1", "t": "who.1"},
  {"f": "write.1", "t": "who.1"},
  ...
]

Implementation

Add a callback parameter if you need it for any of the above:
https://www.mankier.com/api/v2/mans/who.1?callback=cb

Requests are served with this header:
Access-Control-Allow-Origin *


Explain a Shell Command

Explain ls -lh, wrapping text at 70 chars (optional):
https://www.mankier.com/api/v2/explain/?cols=70&q=ls -lh

Result is text:

ls(1)
  list directory contents

  -l (-L)
    use a long listing format

  -h (-H, --HUMAN-READABLE)
    with -L and/or -S, print human readable sizes (e.g., 1K 234M 2G)
                                          https://www.mankier.com/1/ls

History