AnswerBun.com

How do I manually install a man page file?

Ask Ubuntu Asked by Flimm on December 17, 2020

How do I install a man page file system-wide?

For example, if I have a man page file examplecommand.1, how do I install it so that I can just type man examplecommand to view it?

4 Answers

  1. First, find out which section your man page belongs to. If its a command, it probably belongs to section 1. You can read the manpage for the man command Manpage icon to see a description of the different sections and their corresponding numbers.

  2. Copy your man page to /usr/local/share/man/man1/ (change 1 to your section number if need be). You can also install it to /usr/share/man/man1/, but it's best practise to use the local directory for files that are installed without using the APT package manager:

    sudo cp examplecommand.1 /usr/local/share/man/man1/
    
  3. Run the mandb command. This will update man's internal database:

    sudo mandb
    
  4. That's it! You should be able to view the man page by running:

    man 1 examplecommand
    

References:

Correct answer by Flimm on December 17, 2020

For an application binary that was copied to ~/.local/bin, copying its .1 man file to ~/.local/share/man/man1 worked for me on Ubuntu 18.04. I had to create the latter directory. I can now access the man page using man <app_name>.

Answered by Acumenus on December 17, 2020

The answer by @ntc2 above is the one people should be looking at. I wanted to add some extra commentary which didn't fit in the comments section:

The approach by @ntc2 provides a path for people only needing to set their PATH (which they already expect) for local binaries.

However, I don't think the generic mapping <path>/bin -> <path>/share/man exists for all paths in $PATH. It seems like this specific mapping is avoided when the $PATH in question is $HOME/bin. When performing strace(1) on man with MANPATH=:/nonexistingdir, I see the following lookups:

For any element in $PATH that's not $HOME/bin

  • <path>/bin -> <path>/man
  • <path>/bin -> <path>/bin/man
  • <path>/bin -> <path>/share/man
  • <path>/bin -> <path>/bin/share/man

For $HOME/bin

  • $HOME/bin -> $HOME/man

I have no idea why it skips the others. This is on a Debian Buster system. It may be different on other systems.

For me, this means that the safest path to install man-pages is <path>/man, as it's guaranteed to be found if it's in the $PATH.

Answered by Aktau on December 17, 2020

If you only need to install the man page locally :

If MANPATH is unset, or includes an empty component (i.e. starts with :, ends with :, or contains ::), then <path>/share/man will automatically be searched for man pages whenever <path>/bin is part of PATH, for all values of <path>.

This provides a very simple way to add man pages for locally installed software. There are some details in man manpath and /etc/manpath.config, but I don't see any mention of the generic mapping from <path>/bin to <path>/share/man.

Answered by ntc2 on December 17, 2020

Add your own answers!

Related Questions

Ubuntu 18.04 doesn’t see my web camera. Help me please

2  Asked on December 19, 2021 by ubuntumate18

     

19.04 won’t boot after installation

3  Asked on December 19, 2021 by matt-murphey

 

Battery Monitor for Ubuntu 20.04

4  Asked on December 19, 2021 by abdullah-omar

       

Xinerama 1 stuck on login [lightdm]

1  Asked on December 19, 2021 by michael-paccione

     

VirtualBox Ubuntu Stuck, Black Screen with White Spinner

1  Asked on December 19, 2021 by classicjonesynz

     

WedDav folders on Ubuntu Server 18.04.4

1  Asked on December 19, 2021 by walttheboss

       

How to globally disable notifications?

0  Asked on December 17, 2021 by lexible

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP