On Unix-like operating systems, the fmt command is a formatter for simplifying and optimizing text files.

This page covers the GNU/Linux version of fmt.

Description

fmt reformats each paragraph in the FILE(s) specified, writing to standard output. The option -WIDTH is an abbreviated form of –width=DIGITS.

  • Description
  • Syntax
  • Examples
  • Related commands
  • Linux commands help

Syntax

fmt [-WIDTH] [OPTION]… [FILE]…

Options

If no FILE is specified, or if FILE is a dash ("-"), fmt reads from standard input.

Examples

fmt myfile.txt

Display a reformatted version of the file myfile.txt.

fmt < myfile.txt > myfile2.txt

Reformat myfile.txt, and write the output to the file myfile2.txt.

nroff — Format documents for terminal display or line-printer.