Last active
July 26, 2020 23:44
-
-
Save jp-hoehmann/fc15eb998c305f8fc8123bf471971e79 to your computer and use it in GitHub Desktop.
Fetch all manpages available in packages into the current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash -euo pipefail | |
# | |
# Fetch all available manpages. | |
# | |
n=$(apt-cache pkgnames | wc -l) | |
i=0 | |
for e in $(apt-cache pkgnames) | |
do | |
echo "Fetching $e ($((++i)) of $n)" >&2 | |
apt-get --print-uris download $e \ | |
| perl -ne 'print "$1\n" if /^'"'"'(.*?)'"'"'/' \ | |
| xargs -r curl -sL -o- \ | |
| dpkg-deb --fsys-tarfile /dev/stdin \ | |
|| : | |
done \ | |
| tar xv --ignore-zeros ./usr/share/man \ | |
| perl -pe 's/^/+ /' |
Quickstart:
$ mkdir /usr/local/share/extra-manpages
$ wget https://gist.githubusercontent.com/NuvandaPV/fc15eb998c305f8fc8123bf471971e79/raw/be4a4a93665875b3699ba1eb24a5f778950cb8de/fetch-manpages.sh
$ chmod +x fetch-manpages.sh
$ ./fetch-manpages.sh
As /usr/local/share/extra-manpages/usr/share/man
is usually configured to automatically be included in the manpath, this should be all that is needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will run for a couple hours, since it has to download all the packages, but the actual manpages it downloads only consume a few hundred megabytes. Afterward all you need to do is add the new directory to your
MANPATH
and you will never seeNo manual entry for foo
ever again.