FOLD(1)

πŸ“¦ version 1.053, in alpine 3.24

πŸŽ€ fold(1) β€” wrap each input line to fit specified width πŸŽ€

✨ NAME ✨

okay so bestie, this is fold β€” the little Unix icon that wraps each input line to fit a specified width. slay. πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 DESCRIPTION 🌸

fold reads lines from the files you give it β€” or from standard input if you don’t give it any files β€” and writes them to standard output, inserting newlines into lines that are longer than the specified column width. no cap, that’s the whole main character energy. ✨

The default column width is 80, but you can override it with the -w flag. For historical reasons, you can also specify the width directly, like fold -72, omitting the -w. iykyk. 🫢

  • -w width β€” sets the column width; default is 80. and yes, fold -72 is the historical direct-width move where you skip -w entirely.
  • -s β€” makes breaks happen after whitespace instead of in the middle of a word. it’s giving ragged right edge, but honestly it’s much nicer to look at. πŸŽ€
  • -b β€” makes the program ignore embedded backspaces, tabs, and carriage returns when deciding where to split. this makes it run about thirty times faster, so you might want to get used to using -b. literally iconic. πŸ”₯

Current locale settings will be honored in determining what is meant by β€œwhitespace” and β€œword characters”. 🌈

πŸ’€ BUGS πŸ’€

POSIX 1003.2 states that a newline will never be inserted immediately before or after a backspace or a carriage return, but this is not checked for. so like… noted, bestie. πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

πŸ’– AUTHORS πŸ’–

Clinton Pierce and Tom Christiansen.

This code is freely modifiable and freely redistributable under Perl’s Artistic License. periodt. πŸ’œ


xoxo bestie πŸ’– β€” this page is from perl v5.42.2, dated 2026-02-15, and it’s the FOLD(1) page. 🫢

πŸ“¦ where this page comes from