Linux Blog

A Manpage Template for your Scripts

Filed under: Shell Script Sundays — at 11:44 am on Sunday, June 21, 2009

So, you just finished that killer script and the first thing you want to do is write that man page for it right? Not exactly? What do you mean?
Writing a man page isn’t that hard and will give your users an idea of how to use a script.

Here is a basic template for creating your own man pages:

.\" This is a comment
.\" Contact
.TH man 1 "21 June 2009" ".1" "Man Page Example"
Man \- Example Man Page
Example Man Page
This is an example of a man page.
No options for this man page
man(1), groff(1), man.config(5)
No known bugs for this template, except you might want to replace the quotes if you copy from my blog.
Owen (

When you’re done with the gruelling task of writing documentation (which your users won’t read or thank you for) just plop it the correct man section in /usr/share/man
That’s all there is to it!

Man Pages for commands in this post »



Comment by ToMSoms

August 23, 2009 @ 11:52 am

thanks, looks easy.

Comment by wgd

December 16, 2013 @ 6:12 pm

Thanks for the simple template! Exactly what I was hoping to find even though my users will never read it or thank me for it! ;)


Comment by dfong63

January 28, 2016 @ 3:32 pm

thanks for creating this page.

a few suggestions to make it more useful:

explain the meaning of the many arguments to .TH .
explain the meaning of the different numbered sections that the page could go in.

or provide a link to some other pages that provide more detail.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>