April 19, 2017

Printable view of Man pages

The manual for many Unix commands are available via the 'man' functionality.

Unix Header

For example, If I want to find out information about the Date functionality, I simply type in:

man date

Useful information, but this a Macintosh and we can do better. There has to be a better way to view the man page.

View like its 2017

The problem with this way is that you only see a screen size view of the document. To go to the next page, you simply type in the spacebar.

This is 2017, there's no reason to view man pages like this anymore.

Plaintext file View

To get a plain text version of a man page, without backspaces and underscores, try

man calendar | col -b > cal.txt
Now you can view this plain text file in your favorite text editor. You can also view this in Chrome simply by drag and drop file the icon to Chrome or Safari.

Open in a different terminal window

Mac OS comes with a built-in Man viewer that might be useful. Simply type this command

open x-man-page://ls

You get a yellow reference guide. This is nice to have so that you can display the info side-by-side your working terminal:

xmanopen2

BBEdit view

If BBEdit is your favorite editor, simply send a plain text man page directly to BBEdit

man man | col -b | bbedit

bbeditman

Update your .bashrc

Here's a suggested code snippet to add to your bash profile:

function mman() { man $@ | col -b | bbedit; }

So the next time you need to view a man page type in:

mman perl

Then you can search using BBEdit for the feature you are looking for.

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!