1 / 7

How to Create Man Pages for Script, Package, Library in Linux

Man pages are useful documentation. Here is how to create man pages for script, package, library in Linux. <br><br>Visit - https://fedingo.com/how-to-create-man-pages-for-script-package-library-in-linux/

Download Presentation

How to Create Man Pages for Script, Package, Library in Linux

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Create Man Pages for Script, Package, Library in Linux

  2. Install Pandoc Open terminal and run the following command to install pandoc tool. Ubuntu/Debian # sudo apt-get install pandoc Redhat/Fedora/CentOS/SUSE # sudo dnf install pandoc

  3. Sections of Man Pages Here are the minimum sections a man page must have. • Name: Name of command with one-liner that describes its function. • Synopsis: Short description of the invocations someone can use to launch the program. Syntax of command along with placeholders for options and parameters. • Description: Description of the command or function. • Options: List of command-line options, with explanation • Examples: Some examples of common usage. • Exit Values: Return codes with their meanings. • Bugs: List of known bugs and issues. You can also include links to issue tracker if available. • Author: Person or people who wrote the command. • Copyright: Your copyright message with license information

  4. Create Man Markdown Each section of man page must be specified after its own # sign at the beginning followed by space. It acts as a section header. Here is a simplified layout of man page. You can type your text below the section header. # NAME ... # SYNOPSIS ... # OPTIONS ... # EXAMPLES ...

  5. Create Man page Let us say you have stored your above markdown for command ‘ms’ in a file called ms.1.md. Here is the pandoc command to store it in man page ms.1. $ pandoc ms.1.md -s -t man -o ms.1

  6. Create Man page First, we create a separate subfolder man1 for our command. If your command has more than 1 man pages, you can store them in folders man2, man3, .. here. $ sudo mkdir /usr/local/man/man1 Next, copy ms.1 file created to this folder. $ sudo cp ms.1 /usr/local/man/man1 You need to compress this file for man command, as it is required. $ sudo gzip /usr/local/man/man1/ms.1 Run the following command to add the man pages to man database. $ sudo mandb That’s it. Now you can get man page for your command ms using the following command.

  7. Thank You Visit for details https://fedingo.com/how-to-create-man-pages-for-script-package-library-in-linux/

More Related