Text Processing

fmt

Simple text formatter that wraps and fills paragraphs to a specified width.

Synopsis

syntax
fmt [OPTION]... [FILE]...

Examples

Reformat paragraphs to 60-column width
fmt -w 60 article.txt
Split long lines without reflowing
fmt -s long-lines.txt
Reformat for 80 columns
echo 'short lines' | fmt -w 80

Common options

FlagDescription
-wMaximum line width (default 75)
-sSplit long lines only, do not refill
-uUniform spacing: one space between words, two after sentences

About fmt

The `fmt` command simple text formatter that wraps and fills paragraphs to a specified width. Text processing commands transform, format, and generate text output.

Linux's philosophy of small composable tools shines here — these commands are designed to be piped together to build complex text-processing workflows. They are indispensable for scripting, log analysis, and data transformation tasks.

The command accepts 3 commonly used flags shown above, though the full set of options is available in the man page (`man fmt`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Text Processing Commands

Other commands in the Text Processing category

Related tools