fmt
Simple text formatter that wraps and fills paragraphs to a specified width.
Synopsis
fmt [OPTION]... [FILE]...
Examples
fmt -w 60 article.txt
fmt -s long-lines.txt
echo 'short lines' | fmt -w 80
Common options
| Flag | Description |
|---|---|
| -w | Maximum line width (default 75) |
| -s | Split long lines only, do not refill |
| -u | Uniform 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