LinuxCommandLibrary

grog

Display formatted manual pages

SYNOPSIS

grog [-h|--help] [-V|--version] [file ...]

PARAMETERS

-h, --help
    Print usage summary and exit.

-V, --version
    Print version information and exit.

DESCRIPTION

Grog is a lightweight Linux utility that examines the initial portion of a file (or stdin) to heuristically determine its format and outputs a concise shell command for proper display or printing. It shines with documentation formats like troff, groff, and man pages, detecting preprocessors (e.g., tbl, eqn) and suggesting pipelines such as groff -man -Tutf8 file | less. It also recognizes HTML (lynx or w3m), PostScript (gv), DVI (xdvi), plain text (less), and more via magic numbers and patterns.

Ideal for scripts automating file viewing or interactive use on unknown files, grog processes multiple arguments, one per line. For stdin: cat file | grog. Its output is directly executable, saving manual format detection. Limitations include reliance on heuristics, so ambiguous or malformed files may yield suboptimal suggestions. No configuration files; pager is auto-chosen (e.g., less, more).

CAVEATS

Heuristics may misidentify ambiguous or corrupted files.
Requires supporting tools like groff, lynx for output commands to work.
Only scans first ~8KB; large headers might evade detection.

USAGE EXAMPLE

grog foo.1
Typical output: groff -t -man -Tutf8 foo.1 | less -isr
grog index.html
Outputs: lynx -dump index.html

STDIN MODE

Pipe files: cat doc.* | grog
Generates one command per file detected in stream.

HISTORY

Written by Dean Gaudet in 1996 for troff/groff files.
Maintained by Colin Watson; bundled in groff since 1.17 (2001). Widely used in Debian/Ubuntu for man page handling.

SEE ALSO

file(1), groff(1), man(1), magic(5), lynx(1)

Copied to clipboard