6 steps to create linux man page

Create linux man page

Normally we always use linux man page for any help or to get all the details with all options. why don’t we create our customized linux man page. To create linux man page we can use nroff utility. Normally man files are created using troff. troff is a bit difficult to use. So that’s Here we will learn to create linux MAN page for our custom binaries/programs using the command line tool nroff which is very easy to learn.

Follow below steps to create linux man page:

Step 1: Write a manual page in using vi. Use Man format only. for example I have written sample man page using vi for sample command “mycommand”.

Step 2: use below command to create linux man page.

Following are options details:

Step 3: Rename it and give extension 1 to 8, any no. & then compress it with gzip.

Step 4: Create man/man3 directory under your home directory.

Note: Here I renamed the file with the extension. 3, that’s why I created the man3 directory.

Step 5: Move gzip file in $HOME/man/man3  and use updatedb.

Please note that , The system stores its man pages at /usr/share/man/ directory , however to give example with all the details I have used non default location.

Step 6: Then use below command to open the created MAN page.

Here -M is used to give path of man files. If you don’t want to use -M option every time you can add below “MANPATH” entry in “/etc/man.config” file as below, since /etc/man.config stores the details about linux man page.

In above section we have added /root/man or $HOME/man MANPATH entry. Now you can use man command without any option as below.

 

Related posts

Leave a Reply