Answer with desciption
I am running Cygwin on Windows 7. When I try
echo $MANPATH
I get nothing. Here is my portable way of finding where to put new man
pages.
$ { find / -maxdepth 2 -type d -name "*man*" 3>&2 2>&1 1>&3 | \
grep -v 'Permission denied' >&3; } 3>&2 2>&1
(A note on that crazy command is at the bottom of this answer.)
You could simply replace /
with ~
. Another possibility is under the Another note section below.
On my machine, the find
command returned:
/etc/openwsman
/lib/filemanager-actions
/lib/gnome-commander
/lib/help2man
/lib/window-manager-settings
/share/man
/usr/man
To me, that meant there were two possibilities: /share/man
and /usr/man
.
I chose to use /usr/man
, which you wouldn't, but I needed to do some more exploring.
$ ls -l /usr/man
total 0
drwxr-xr-x+ 1 me Users 0 April 31 17:13 man1
So, where I had the new man
files in a doc/
sub-directory of my working directory, I used
$ cp -R doc/* /usr/man/man1
Now, I could get to my "manual" by typing
$ man my_new_executable
If you don't see a likely candidate, you can remove this part or change it, e.g. to -maxdepth 3
, or 4
, or 5
, or however deep it takes to find what you need. When I did so with 3
, I found two other candidates, /var/cache/man
and usr/share/man
, but I had already found a working solution, so I didn't mess with them.
Another note
I believe that /share/man/man1
or /var/cache/man
would be available to non-root users, as you had requested. Please, correct me if I am wrong.
The promised note at the bottom
Note that I used the -maxdepth 2
option with find
, because I figured that the man
directory would be within two directories of the file system root, and I did not want to get too many extraneous directories that somehow had the substring man
, as did /lib/gnome-co
mander
.
The extra stuff around the find
is there to suppress any Permission denied
errors in case you don't have access to su
or sudo
. Here is a great description of what's happening. (Look for the line that starts with "gniourf_gniourf".)
manpath
warnings aboutMANPATH
being set, you can pass the-q
option. – Joseph R. Sep 15 '13 at 14:46man
where to look. I'm looking for a generic, portable way for an generic installation (ie: where isman
looking on a standard configuration) – Romuald Brunet Sep 17 '13 at 13:02echo $MANPATH
and see what that shows. Those are good places to start looking, or use themanpath
command as I showed in my answer. – slm Sep 17 '13 at 13:03$HOME/.local/share/man
? I could not find any official source for that. – Yaroslav Nikitenko Jul 12 '22 at 19:19