Skip to content

Instantly share code, notes, and snippets.

@sampart
Last active December 28, 2015 08:19
Show Gist options
  • Save sampart/7470419 to your computer and use it in GitHub Desktop.
Save sampart/7470419 to your computer and use it in GitHub Desktop.
Ubuntu-friendly version of the script at http://www.benzado.com/blog/post/319/nicer-ways-to-view-unix-man-pages; "manp" allows you to view man pages as nicely-formatted PDFs in your PDF viewer. The original Mac version linked to above was a function. This is a shell-script, so put it somewhere in your path. (I originally made this as a function …
#!/bin/bash
M=`man -w $*` # Get path of page source.
if [ -z $M ]; then exit; fi # Quit if it doesn't exist.
N=`basename $M .gz` # Extract the name of the file and
P=/tmp/man.$N.pdf # use it to create a PDF file name.
if [ ! -e $P ]; then # If the PDF file doesn't exist,
echo Creating PDF for $N...
man -t $1 | ps2pdf - $P # generate it.
fi
xdg-open $P # Open the PDF version.
@sampart
Copy link
Author

sampart commented Nov 15, 2013

I also really like the solution here to make the standard man command include colours (but I prefer the colour-scheme given on this page.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment