— fold long
lines for finite width output device
is a filter which folds the contents of the
specified files, or the standard input if no files are specified, breaking the
lines to have a maximum of 80 display columns.
The options are as follows:
- Count width in bytes
rather than column positions.
- If an output line would be broken after a non-blank
character but contains at least one blank character, break the line
earlier, after the last blank character. This is useful to avoid line
breaks in the middle of words, if possible.
- Specifies a line width to use instead of the default of
is specified, a backspace character
decrements the column position by one, a carriage return resets the column
position to zero, and a tab advances the column position to the next multiple
- The character encoding
locale(1). It decides which
byte sequences form characters and what their display width is. If unset
or set to “C”, “POSIX”, or an unsupported value,
each byte except backspace, tab, newline, and carriage return is treated
as a character of display width 1.
utility exits 0 on success,
and >0 if an error occurs.
utility is compliant with the
IEEE Std 1003.1-2008
utility first appeared in
. It was rewritten for
to improve speed and modernize style. The
were added to NetBSD 1.0
IEEE Std 1003.2 (“POSIX.2”)
wrote the original version of
on June 28, 1977.
rewrote the command in 1990,
and J. T. Conklin
added the missing options
semantics, implemented both by GNU nroff and by
, only uses a single
backspace for backing up the previous character, even for double-width
characters. The fold
backspace semantics required
by POSIX mishandles such backspace-encoded sequences, breaking lines early.
utility provides similar
functionality and does not suffer from that problem, but isn't standardized by