man

Using Manpages

Useful man commands

macOS

brew install man-db
path=(/usr/local/opt/man-db/libexec/bin ${path})

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.

MANPATH

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

manpath
manpath -c

Random Notes

Making a PDF of a manpage

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

# 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


Posted on: Feb 4, 2020
Last modified: Sep 16, 2020