Tuesday, May 7, 2024
71
rated 0 times [  71] [ 0]  / answers: 1 / hits: 48014  / 2 Years ago, sat, october 8, 2022, 6:56:00

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?


More From » command-line

 Answers
4

  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 practice to use the /usr/local/ directory for files that are installed without using the APT package manager. You can also optionally symlink over the file instead of copying it if you want:


    # First, ensure your local man page directory exists for your section of
    # interest (section 1 in this case, so the `man1` dir)
    sudo mkdir -p /usr/local/share/man/man1

    # Option 1: **copy** over the man page to section 1
    sudo cp examplecommand.1 /usr/local/share/man/man1/

    # Option 2: **symlink** over the man page to section 1.
    # NB: This cmd assumes you are already cd'ed into the dir in
    # which "examplecommand.1" is found, prior to running this cmd.
    sudo ln -si "$PWD/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:



[#33139] Monday, October 10, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ditery

Total Points: 9
Total Questions: 116
Total Answers: 119

Location: Grenada
Member since Sun, Dec 20, 2020
3 Years ago
ditery questions
;