fold

break lines into shorter lines 

Command


SYNOPSIS

fold [-bs] [-w width] [-width] [file...]


DESCRIPTION

fold reads the standard input, or each file, if you specify any. Each input line is broken into lines no longer than width column positions. If you do not specify width on the command line, the default line length is 80. The output is sent to the standard output.

Options

-b 

specifies the width in bytes rather than in column positions; that is, fold does not interpret tab, backspace, and carriage return characters.

-s 

breaks each line after the last blank within width column positions. If there is no blank that meets the requirement, fold breaks the line normally.

-w width 

specifies a maximum line length of width column positions.

-width 

is identical in effect to -w width.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to one of the following:

— cannot open the input file
2 

Invalid command line option or a missing width argument.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. 4.2 BSD UNIX. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.

The -width option is an extension to the POSIX standard.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
pr


PTC MKS Toolkit 10.5 Documentation Build 40.