commands
fold — wrap long lines
Wrap input lines to selected width (default 80 columns), -s prefers blanks, -b counts bytes rather than columns. Produces altered line boundaries on stdout. Example assumes a fresh text-streams lab fixture.
Formal Syntax & Structure
linux syntaxlinux
fold [OPTION]... [FILE]...Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -w | option | Width |
| -s | option | Break at blanks |
| -b | option | Count bytes |
| FILE | operand | Input file |
Return Value
exit status and output
GNU fold writes wrapped text and returns nonzero on read/write errors. Short input can pass through unchanged; verify line width according to the chosen column/byte mode.
Working Example
Example Snippetlinux
fold -w 4 long.txt