I'm not sure how well known this is and I kind of stumbled on it while playing around when taking some notes on system commands. In a nutshell, with the right setup it's possible to link man pages on Linux using URLs like man:///path/to/manpage-file.
Personally, the system on which I'm using Joplin right now is a Linux Mint 20.1 Xfce and this works right out of the box, but let's not assume that's the case for everyone, so here are a few things you can try/check:
-
For example, the
lesspager should be present on most systems, and its man page is likely located on yours at/usr/share/man/man1/less.1.gzas well (if you have English man pages installed), so try copying this into a note:[less(1)](man:///usr/share/man/man1/less.1.gz)If the file itself doesn't exist, pick another one from a subfolder of
/usr/share/maninstead. -
From what I understand, this is driven by a desktop's implementation of the XDG (acronym for "Cross-Desktop Group") freedesktop.org standards. In a desktop terminal emulator you can try the following:
# open an URL, same as in Joplin: xdg-open man:///usr/share/man/man1/less.1.gz -
URL handlers are registered with a
x-scheme-handler/...MIME type, and there's an XDG tool to get some information:# Find out where the man:// URL handler is associated: xdg-mime query default 'x-scheme-handler/man'On my system, this prints
yelp.desktop, which is the.desktopfile for Yelp, the GNOME help browser. You might be able to get it with e.g.apt install yelp. Side note: Yelp understands some other URLs as well, e.g.info://...for GNU Info manuals. -
There should be a global and possibly a user specific cache file containing the URL
handlers. These are populated with data from.desktopfiles. See
/usr/share/applications/mimeinfo.cacheand maybe~/.local/share/applications/mimeinfo.cache.
But how to find the right file path for a man page? These can be located in quite a few places on the file system. The short answer is to simply have the man command tell us with -w:
# Print a man page's full path:
man -w <page>
Long answer: There's a program to display a colon-separated list of these search paths:
manpath
The idea now is to use find with all these paths (this is a simple variant which only works if there are no spaces in what manpath returns), e.g. for bash:
find $(manpath | sed 's/:/ /g') -iname 'bash*'
and you might get:
/usr/share/man/man7/bash-builtins.7.gz
/usr/share/man/man1/bashbug.1.gz
/usr/share/man/man1/bash.1.gz
