What is MIME type "text/troff"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

text/troff is the MIME type for files written in the troff formatting language.
It combines plain text with commands that control layout and style. When processed by tools like groff or nroff, these files become well-formatted pages ready for printing or screen display.

Main uses: Files using this MIME type may have extensions such as MS, ROFF, or PIC. These examples show how troff is applied in different contexts, from manual pages to specialized documents.

Since text/troff files are plain text, you can edit them in any text editor. However, you need a troff processor to render the formatting commands. This makes the format versatile yet dependent on Unix-like processing tools.

For additional details on troff and its history, see Wikipedia - Troff.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/troff    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/troff">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/troff');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the text/troff MIME type used for?

The text/troff MIME type is primarily used for Unix manual pages (man pages) and technical documentation formatted with the troff or groff typesetting systems. Files using this type, such as those with .man or .1 extensions, contain plain text mixed with macro commands to define layout and styling.

How do I view the rendered output of a troff file?

Because these are source files, opening them in a text editor shows raw code; to see the formatted document, you must use a processor like the Unix man command or GNU groff. For example, running man ./file.1 in a terminal displays the page with correct indentation and bold text.

How do I configure Apache to serve text/troff files?

You can map the relevant extensions to this MIME type in your .htaccess or global configuration file. Add the line AddType text/troff .man .1 .me .ms .roff to ensure that Apache sends the correct Content-Type header for these documents.

Why does my browser download .man files instead of rendering them?

Web browsers like Chrome and Firefox do not have built-in engines to interpret and render troff formatting macros. Consequently, they usually treat text/troff content as either raw plain text or a generic download, depending on the server headers.

What do the numbered extensions like .1, .5, and .8 signify?

These numbers correspond to specific sections of the Unix manual system, even though they all use the text/troff format. For example, an extension like .1 denotes user commands, while .5 denotes file formats and conventions.

Can I convert text/troff files to PDF or HTML?

Yes, you can use the groff tool to convert these files into modern formats. Using the command groff -man -Tpdf input.man > output.pdf generates a PDF, while switching the flag to -Thtml produces a web-compatible HTML file.

Is text/troff the same as application/x-troff?

text/troff is the standard, IANA-registered media type for these files and is generally preferred. The type application/x-troff is an older, non-standard experimental tag, though some legacy systems may still use it interchangeably.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.