Getting Started

If you're on macOS, by default you'll be using a pretty old version. The new version can be installed using Homebrew

brew install man-db

# Add the man-db directory to your path
>> ~/.zshrc < =(<<<"\npath=(${file} \${path})")

Store cached versions of your manpages

Useful man commands

Opening manpages using NeoVim

MANPAGER='nvim +Man!'

Caching manpages

Some manpages take forever to load, even on modern computers. The main culprit that inspired this post was zshall(1), which takes 8 seconds to load on my machine. I was able to get it down to 2 seconds by caching a processed version of each manpage on my computer. Even with over 8,000 manpages, the total size of the cache only ended up being 20MB large.


You shouldn't need to set the MANPATH environment variable, but here are some useful commands

manpath -c

Random Notes

Making a PDF of a manpage

# Saving the produced manpage before opening it
man -t grep > ./
open -a 'Preview' ./

# Directly opening the file through a pipe
man -t grep | open -f -a 'Preview'

Useful statements macros

Making a table

Useful macros

Anatomy of a Manpage

  1. TH: Title heading
.TH "LS" "1" "March 2019" "GNU coreutils" "List Files"
  1. SH: Section Heading

Manpage Formatting

This is a snippet of the introductory content for the tar(1) manpage

.TH TAR 1 "February 4, 2019" "TAR" "GNU TAR Manual"
tar \- an archiving utility
.SS Traditional usage
\fBtar\fR {\fBA\fR|\fBc\fR|\fBd\fR|\fBr\fR|\fBt\fR|\fBu\fR|\fBx\fR}\
[\fBGnSkUWOmpsMBiajJzZhPlRvwo\fR] [\fIARG\fR...]
.SS UNIX-style usage
\fBtar\fR \fB\-c\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR \fB\-d\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR \fB\-t\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
\fBtar\fR \fB\-r\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR \fB\-u\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR \fB\-x\fR [\fB\-f\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]
.SS GNU-style usage
\fBtar\fR {\fB\-\-catenate\fR|\fB\-\-concatenate\fR} [\fIOPTIONS\fR] \fIARCHIVE\fR \fIARCHIVE\fR
\fBtar\fR \fB\-\-create\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR {\fB\-\-diff\fR|\fB\-\-compare\fR} [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIFILE\fR...]
\fBtar\fR \fB\-\-delete\fR [\fB\-\-file\fR \fIARCHIVE\fR] [\fIOPTIONS\fR] [\fIMEMBER\fR...]

Learn more about manpages

If you want to learn more about how to read manpages, take a look at the following manpages

If you're trying to write a manpage, take a look at these manpages