Open In App

groffer Command in Linux with Examples

Last Updated : 28 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The groffer command is a powerful utility in Linux used for viewing Groff files and man pages on various platforms, including the X Window System, terminal (tty), and other document viewers. It simplifies the process of displaying formatted documents, allowing users to read and search manual pages or Groff-formatted files easily.

  • groff files - files made by using groff command. Groff is typically used to create man pages.
  • man page - man page(manual page) is documentation of different commands available in Linux.
  • X Window System (X) - X Windows system provides the base for GUI on the Linux Operating System.
  • tty - tty is short of the teletype, but popularly known as a terminal. It allows us to interact with the system.

We can also decompress the compressed files that are handled by gzip or bzip2 with the help of the groffers command very easily.

Installing the groffer Command

In some Linux distros, the groffers command is not installed by default. You can do it using the apt package manager by entering the following command in cmd:

sudo apt install groff

Syntax:

groffer [mode-option ...] [groff-option ...] [man-option ...] [X-option ...]
[--] [filespec ...]
  • Mode Options: Control the output format, such as --ps for PostScript or --tty for terminal mode.
  • Groff Options: Pass options directly to the groff command.
  • Man Options: Options that affect the display of man pages.
  • X Options: Control the display settings for the X Window System.
  • Filespec: The file or man page to be displayed. This parameter is not optional and must be provided.

Note: The filespec parameters are not optional parameters. They are to be provided by the user for groffer command to work or display some sort of output. 

Working with groffer Command

1. To display a file or man page

The most basic use of groffer is to display a file or man page. By default, it will display the content in PDF format.

groffer printf
1. To display a file or man page.  By default, groffer will display these files in PDF format.

2. To concatenate multiple files into one pdf

You can combine multiple files into a single output file for easier viewing using this command.

groffer printf scanf file.txt
2. To concatenate multiple files into one pdf.

3. To display man pages categorized into different sections

For example, printf command has two section_extensions: printf(1) and printf(3).

groffer printf.1 printf.3
To display man pages categorized into different sections

Note: In Linux systems, these section_extensions  are denoted by a digit from 1 to 9 while in UNIX systems by one of the characters from n & o.   

4. To search the filespec argument in man page descriptions

The --apropos option allows us to search for a term in man page descriptions.

groffer --apropos printf

Note: section_extension isn't supported with the apropos command. 

Example: Searching printf with --all option will also display synopsis about printf, fprintf, dprintf, sprintf, snprintf, vprintf, etc.

groffer --all printf
To display all the man pages related to the given filespec argument.

6. To display the files or man pages in the Postscript viewer program (ps mode)

Use the --ps option to view the output in a PostScript viewer.

groffer --ps printf
To display the files or man pages in the Postscript viewer program (ps mode).

7.  To generate device output with plain Groff

If you want to generate output using plain groff, use the --groff option.

groffer --groff printf
To generate device output with plain Groff.

8. To display the output in terminal or tty mode

The --tty option forces the output to be displayed in a text terminal.

groffer --tty printf

Conclusion

The groffer command in Linux is a adaptable utility for displaying Groff-formatted files and man pages across different viewing interfaces. Its ability to handle compressed files and support multiple output formats makes it an essential tool for system administrators and developers who need to read documentation efficiently. By mastering the groffer command's various options and use cases, you can significantly improve your documentation viewing experience on Linux.


Next Article

Similar Reads