2

Context

Often when writing something related to Linux commands I want to mention the use of an option of a command.

For example, I could write something like:

You could use the tail -f <file> command to get a scrolling log, here's more information on the -f option.

I can link to various websites that show the full man page of tail, but I cannot find a website where I can link to the description of the -f option directly. The recipient of the message always needs to scroll or do a search for the option I refer to.

Question

Is there a man page website that provides anchors or tags for the command options such that I can link to it directly? Ideally I would be able to link to something like somesite.org/man/commandname#option-name.

5
  • Hi. Have you tried searching or asking on unix.stackexchange.com ?
    – Z Z
    Commented Mar 30, 2021 at 13:22
  • Also try the unix tool "man2html" to see if it generates what you want using your own system's help file. Then you can use that if it works...
    – Z Z
    Commented Mar 30, 2021 at 13:31
  • @ZZ, thanks for the suggestion on man2html, however then I would need to host my own webpage to which I can refer other people. It's possible, but I was hoping an existing solution would exist. If no answers will be created I will delete this question and will post it on the unix site (as cross-posting is discouraged). Commented Mar 30, 2021 at 13:53
  • 1
    Does this count?
    – ssbssa
    Commented Mar 31, 2021 at 10:44
  • @ssbssa Definitely! Can you add that as an answer? Also, if you know of a similar site for GNU man pages, feel free to add that. Thanks! Commented Mar 31, 2021 at 11:26

2 Answers 2

2
+50

Likely, you are looking for explainshell.com

https://explainshell.com/explain?cmd=tail+-f+file

enter image description here

Other example for ls -ltrapR

https://explainshell.com/explain?cmd=ls+-ltrapR

1

How about generating with man2html, filtering as required, and hosting on a gh-pages (or gitlab pages) repository?

tail -f

This was generated with the following script:

#!/usr/bin/env zsh

touch .nojekyll

: > index.html

for m in /usr/share/man/**/*(.); do
    target="${m#/usr/share/man/}";
    target="${target%.gz}";
    printf %s\\n "$target";
    printf %s\\n "$target" | sed -e 's/&/&amp;/g' | sed -e "s/'/\&quot;/g" | sed -e 's/</\&lt;/g' | sed -e 's/>/\&gt;/g' | sed -e 's~.*~<a href="&">&</a><br />~' >> index.html
    mkdir -p "$(dirname "$target")";
    man2html "$m" | sed -ne '/^$/,$p' | perl -pe 'BEGIN{$k=0};s/<DT>/"<DT id=\"" . ++$k . "\">"/e' > "$target.html";
done

I can't promise I'll keep these online (most pages seem to have a COPYRIGHT section which specifies the open-source license that they use, and I don't think I have any proprietary packages installed, but I might've missed a couple in which case I'll take them down if I notice or anyone else points it out) or that I won't improve the links, so if you actually want reliable permalinks, host your own copy by forking the repo :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.