Plurrrr

a tumblelog
23 May 2019

Open a man page as PDF on macOS

In the afternoon I found a nice Bash function in the comments section of Hacker News by user danielecook, reformatted to fit the width of this page:

function pman() {
    man -t ${1} |
    open -f -a  \
    /Applications/Preview.app
}

It calls man with the given argument and the -t option, which outputs the man page as PostScript. This output is piped to the open command with the -f option to read from standard in, the pipe in this case, and opens the application specified with -a with this output.

Very neat.

The Art of Command Line

This is a selection of notes and tips on using the command-line that we've found useful when working on Linux. Some tips are elementary, and some are fairly specific, sophisticated, or obscure. This page is not long, but if you can use and recall all the items here, you know a lot.

Check out The Art of Command Line