44
Cris-Mac-Book-2:src cris$ man up
No manual entry for up

How can I remedy this situation?

I want to add an 'invented' manual entry for a non-existant command up so I can type man up when required. Suggestions of stuff to include are welcome additions to manual adding instructions.

Also, in case my workstation ever gets female users, I will be sure to ln woman :

Cris-Mac-Book-2:src cris$ sudo link /usr/bin/man /usr/bin/woman
Cris-Mac-Book-2:src cris$ woman
What manual page do you want?
Cris-Mac-Book-2:src cris$ 

Though I should probably change that to Which womanual page do you want? -- would that involve re-compile or is there a patch?

4
  • 4
    Too interesting to pass up Commented Feb 26, 2013 at 7:27
  • 3
    You should also symlink lawyer so that if you ever find yourself in a precarious situation you can lawyer up. Commented Feb 26, 2013 at 16:06
  • 5
    Yes, wise! And even though I tried nice lawyer up it still wanted to use all of the system resources. Commented Feb 26, 2013 at 17:08
  • 1
    And it's a Hot Question! Commented Feb 26, 2013 at 19:22

2 Answers 2

31

Here seem to be good instructions for adding a new manual page:

HowTo: Linux / UNIX Create a Manpage

In short, a manpage is simply a text file, with additional formatting information for troff

Its usually in the format

.\" Manpage for up.
.\" Contact [email protected] to correct errors or typos.
.TH man 8 "06 May 2010" "1.0" "name man page"
.SH NAME
up \- into a higher position or level
.SH SYNOPSIS
up [anything you like]
.SH DESCRIPTION
up is a pretty good place to be
.SH OPTIONS
up does not take any options, though you can choose the speed of your acent 
.SH SEE ALSO
yes(1), time cat (2) cal 3() 
.SH BUGS
No known bugs. Gravity is not a bug, "Its a feature"
.SH AUTHOR
Chris Stringfellow ([email protected])

Save this as up

You can then view the manpage with man ./up from the same directory

Man pages are usually under /usr/local/man/man8/ and gzipped

You can copy over your manpage with cp up /usr/local/man/man8/up.1 then gzip it with gzip /usr/local/man/man8/name.1

You can then test it with man up - which should output something like this

1
  • 4
    Also, if writing raw *roff markup isn't your cup of tea, you could e.g. write the page in POD and use pod2man to convert it into a man page. Commented Feb 26, 2013 at 13:17
8

Though I should probably change that to Which womanual page do you want? -- would that involve re-compile or is there a patch?

Recompiling yields the best results, but this should do in the meantime:

#!/bin/bash

ARG=${1/woman/man}

man $ARG > /dev/null 2>&1

if [ $? -eq 0 ]; then
    man $ARG 2> /dev/null \
        | sed \
            -e 's/\(m[ae]n\)/wo\1/g' \
            -e 's/\(M[AE]N\)/WO\1/g' \
            -e 's/M\([ae]n\)/Wom\1/g' \
            -e 's/    //' \
            -e 's/\([^ ]\)  /\1 /g' \
        | less
else
    man $ARG 2>&1 | sed -e 's/\(m[ae]n\)/wo\1/'
fi

Save as /usr/sbin/woman, set execution permissions and start testing:

woman
woman down
woman woman
3
  • 2
    However I detected an error in my new woman. She keeps saying No wo0ual entry for down -- what did I say wrong? Commented Feb 26, 2013 at 17:27
  • woman sed only mentions \1 through \9 for s/regexp/replacewoment/, so \0 might not be available in all flavors and versions of sed. I've edited my answer.
    – Dennis
    Commented Feb 26, 2013 at 19:13
  • 2
    I'll be sure to check woman sed next time -- they are usually right! ;) BTW it works now. No womanual entry for sex is classic. Sed woman page is a deadset classic : A single comwomand may be specified as the first arguwoment to sed. Commented Feb 26, 2013 at 22:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .