70 likes | 89 Views
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/
E N D
How to Create Man Pages for Script, Package, Library in Linux
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
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
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 ...
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
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.
Thank You Visit for details https://fedingo.com/how-to-create-man-pages-for-script-package-library-in-linux/