Back to the command reference

fold

ShellFundamentals In simulator In real Linux

Wrap lines to a given width

Name: fold

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

fold wraps lines longer than a given width (80 by default). -s breaks at spaces where possible so words aren't cut in half.

Syntax

fold [OPTION]... [FILE]...

Common options

-w / --width WIDTHLine width (default 80)
-s / --spacesBreak at spaces
-b / --bytesCount bytes rather than columns

Examples

  • $ fold -w 40 -s article.txt

    At most 40 characters per line

    Explain

Related