Creating a linux man page

Structure of a Man page

Title Header (.TH)
Section Header (.SH)
Name of command (.NM)
Paragraph (.TP)
Synopsis
Description
Options
Resources
Diagnostics
See also
Copyright
Bugs
Authors

mymanpage.1
—————————————————————

.TH MYMANPAGE 1
.SH NAME mymanpage \- A Demo
.SH SYNOPSIS .B mymanpage [\-option ...]
.SH DESCRIPTION .PP \fImymanpage\fP is a complete application that
 does nothing useful.
.PP It was written for demo
.SH OPTIONS .PP It doesn't have any, but let's pretend, to make
 this template complete:
.TP .BI \-option If there was an option ...
.SH RESOURCES .PP mymanpage uses almost no resources.
.SH DIAGNOSTICS The program should provide info about what it does
.SH SEE ALSO The only other program we know with this little
 functionality is the hello world application.
.SH COPYRIGHT
This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published
 by the Free Software Foundation; either version 2 of the License,
 or (at your option) any later version.
.SH BUGS There were a few bugs
.SH AUTHORS Raja

———————————————————–

After saving the file, type at the terminal:

[raja@AGRAJA~]#groff -Tascii -man mymanpage.1

Installing the man page:

[raja@AGRAJA~]#gzip mymanpage.1
[raja@AGRAJA~]#cp mymanpage.1.gz /usr/share/man/man1

Test the man page:

[raja@AGRAJA~]#man mymanpage
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s