man -k . | awk '{ print $1, $2 }' | dmenu -i -p man | awk '{ print $2, $1 }' | tr -d '()' | xargs man -t | ps2pdf - - | zathura -
This uses dmenu
to search through your man pages then produces a pdf for the one you selected
man -k .
lists all man pagesawk '{ print $1, $2 }'
prints the first column, a space then the second columncurl (1)
dmenu -i -p man
takes a list from stdin
and lets you choose one. It returns what you chosedmenu
for something like rofi
if requiredawk '{ print $2, $1 }'
puts the second column first(1) curl
tr -d '()'
removes the parenthesesxargs man -t
puts the result at the end of the command man -t
man -t 1 curl
-t
flag makes man use troff
to format the pageps2pdf - -
produces a PDF from the postscript output by the previous commandzathura -
is a PDF reader that can read STDINYou will need a PDF viewer that can read from stdin
.
You will need ps2pdf
installed which is part of ghostscript.
You will need dmenu
or a dmenu compatible program installed.