It's basically like a much better version of the fold command for wrapping text:
-
It reflows text that already has line breaks
… instead of preserving those line breaks like
folddoes -
It supports a soft column limit and a hard column limit
… whereas
foldonly supports a hard column limit -
It uses a more intelligent layout algorithm
It will actually look ahead when deciding where to split text to make paragraphs look less ragged.
-
It preserves indentation!
-
It wraps at word boundaries by default
… whereas with
foldyou have to opt into this using-s
Best of all, fmt is widely available! Both fold and fmt are part of the GNU coreutils package, so if you have fold on your system you likely have fmt installed, too.