You are here: >

Linux and Unix fold command

fold commandAbout fold
fold syntax
fold examples
Related commands
Linux and Unix main page

About fold

fold wraps each line of input text to fit a specified line width.

fold syntax

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

Options

-b, --bytes count bytes rather than columns.
-s, --spaces break at spaces.
-n, -wn, --width=n use n columns instead of the default of 80.
--help Display a help message and exit.
--version Display version information and exit.

If no FILE is specified, fold reads from standard input.

fold examples

fold -w5 myfile.txt > newfile.txt

Wraps the lines of myfile.txt to a width of 5 characters, and writes the output to newfile.txt.

cut — Remove or "cut out" sections of each line of a file or files.
pr — Format a text file for printing.