Linux Text Processing Cheat Sheet/Wrap text to 72 columns

Reflow long text paragraphs.

Section: Formatting and Cleanup

Wrap text to 72 columns

bash
bash
fmt -w 72 README.txt
Explanation

`fmt` is useful for quickly wrapping plain text to a target width.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Formatting and Cleanup
Force hard wraps
Break long lines at a fixed width.
OpenIn sheetbashsame section
Squeeze repeated spaces
Collapse multiple spaces into one.
OpenIn sheetbashsame section
Trim leading whitespace
Remove spaces and tabs from the start of each line.
OpenIn sheetbashsame section
Trim trailing whitespace
Remove spaces and tabs from line endings.
OpenIn sheetbashsame section
Pipe file content into grep
Basic pipeline for filtering text from a file.
Show first 20 lines
Preview the top of a file.