Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a (RESTful) API for the linux man pages? [closed]

I'm looking for a way to query the linux man pages through an API, the closest I've found is http://linux.die.net/man, however there the commands are split into 8 sections, e.g. gcc is in section 1: http://linux.die.net/man/1/gcc, and as it's not actually an API so you get a full html page (sidebar and ads included) in return.

Before I plough on and try to make one, does something like this already exist?

like image 369
Phil Avatar asked Jun 12 '12 07:06

Phil


People also ask

What is REST API and how does it work?

This solution is not portable as well. In REST API, you ask the API server what you need and it sends you just the information you ask for, no additional formatting is done in the server. There is no need for unnecessary processing in the server. So, the performance of your website and apps are naturally improved.

What are Linux man pages?

RTFM! How to Read (and Understand) the Fantastic Man Pages in Linux The man pages, short for reference manual pages, are your keys to Linux. Everything you want to know is there – take it all in an run with it. The collection of documents will never win a Pulitzer prize, but the set is quite accurate and complete.

How do I open the LS man page in Linux?

man opens the manual page of the ls command. You can move up and down with the arrow keys and press q to quit viewing the man page. Usually, the man pages are opened with less so the keyboard shortcuts for less command work in man as well.

What is the output format of the REST API?

The output format of the REST API is JSON also known as JavaScript Object Notation. An example of the output of a GET request to the REST API on /users/id/12 endpoint may look as follows: As you can see, I did a GET request on /users/id/12 endpoint to tell the REST API to give me information about the user who has the id 12.


1 Answers

Why not just use your local man pages? Man pages are just compressed text files of nroff source code. nroff is confusing and weird, but should be doable. A man page creation guide should make it clear.

For the location of the files, use man -w COMMAND. On my machine man -w man gives me /usr/share/man/man1/man.1.gz. So my man files are stored in the subdirectories of /usr/share/man. Probably would be easy to index from there.

If you look hard enough, someone probably already wrote a man page parser.

like image 180
ssmy Avatar answered Oct 03 '22 19:10

ssmy