A website tipped me off to a Terminal command that lets OS X users (the geekier ones) view UNIX “man” pages* as PDFs.
However, since the command is long, it would be hard to remember and difficult to type. I wanted to make an alias (a custom UNIX command) that would be shorter, but Bash (the default terminal in OS X) does not allow aliases to accept arguments (variables), which is critical to making this work.
I found a way to create a custom command that does this. Here are the steps:
- Edit your ~/.bash_profile with your favorite text editor
- Add this line:
[cc]manpdf () { man -t $1 | open -f -a Preview.app ; }[/cc]
(You could call it something other than “manpdf” if you want; you may also want to add a comment to remind yourself what it does.) - Save it
- Try it: Open Terminal and type:
[cc]manpdf ping[/cc]
Enjoy!
*For newbies: The “man” command lists instructions — “manuals” — for various UNIX commands. For example, if you wanted to know how to use the “ping” command, you could open Terminal and type “man ping”.