-1

I'm trying to create a man script with out any success. Where in my files should I be placing my testScript.1 file for it to work visually as a man page?

So far I've tried by storing it just within two newly created directories in my home directory like so:

~/lab2/man1/testScript.1

I've also tried compressing the testScript.1 file into a tar.xz file and manually moving it to /usr/share/man/man1 with the file manager, but permission seems to be denied for some reason.

Also, when I try:

man testscript

the only result is: "No manual entry for testscript"

Where should it be located and how do I get it in there when "permission is denied" Thanks

hackerNuB
  • 13
  • 7
  • [What is `MANPATH`](https://www.google.com/search?q=what+is+MANPATH) for the win! – jww Apr 25 '19 at 12:14
  • man will also search the path and for specific directories off of it--unless and administrator has set up something different. In this case, if `~/lab2/bin` was on the path, then `~/lab2/share/man/man1/testScript.1` should work too. Of course, you can just specify the path on the man command line too: `man ~/lab2/man1/testScript.1`. And yes, areas like `/usr/share` are owned by root, so you'd need special permission to put the file there. – John Szakmeister Apr 25 '19 at 12:24
  • Finally, something worked! I tried: **man ~/lab2/man1/testScript.1** and that worked! How would I go about just shorting that to **man**? @JohnSzakmeister – hackerNuB Apr 25 '19 at 12:36

2 Answers2

0

You can either put your manual pages in the shared location (and you need root privileges for that) or store them wherever you want and tell man to use that folder.

From man man page:

   -M  path
          Specify the list of directories to search for man pages.  Separate the directories with colons.  An empty list is the same as not specifying -M at all.  See SEARCH PATH FOR MANUAL PAGES.
Poshi
  • 5,332
  • 3
  • 15
  • 32
0

On my system, I simply launched man man, giving (amonst others) following results:

ENVIRONMENT
   MANPATH
          If $MANPATH is set, its value is used as the path to search for manual pages.
   ...

FILES
   /etc/manpath.config
          man-db configuration file.

   /usr/share/man
          A global manual page hierarchy.

   /usr/share/man/index.(bt|db|dir|pag)
          A traditional global index database cache.

   /var/cache/man/index.(bt|db|dir|pag)

While checking the /etc/manpath.config, I've seen this:

# There are three mappings allowed in this file:
# --------------------------------------------------------
# MANDATORY_MANPATH                     manpath_element
# MANPATH_MAP           path_element    manpath_element
# MANDB_MAP             global_manpath  [relative_catpath]
#---------------------------------------------------------
...

Apparently there's a link between the location of your script and the place where to look for the man-pages.

I could explain how it's done, but as I expect this to be different on every system, I'd advise you to launch the mentioned commands and read the config file, it's quite self-explaining.

Dominique
  • 16,450
  • 15
  • 56
  • 112