fold on Linux hard-wraps lines at a character width — useful when pasting log excerpts into tickets, emails, or narrow terminals without scrolling sideways.
Pair with: head & tail,
grep,
column.
Fixed width
Default is 80 columns — override with -w.
bashwidth
fold -w 72 long-lines.txt | head

Break at spaces
-s tries not to split words when possible.
bashspaces
fold -s -w 60 /var/log/syslog | head

Pipelines
Wrap after extracting lines with grep.
bashpipe
grep ERROR huge.log | fold -s -w 100 | less

Not markdown
fold is plain text — use prettier tools for HTML or Markdown rendering.
TipFor wide tables,
column -t often reads better than fold.
Quick Reference
fold -w 80 file- Word-friendly:
fold -s -w 72 file - Often piped after
grep
Related tutorials
Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.