-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux fold Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to fold on Linux, covering Arch Linux, CachyOS, and other distributions including line wrapping, text folding, and width limiting.
Basic usage:
# Wrap lines
fold file.txt
# Wraps to default width (80)Set width:
# Custom width
fold -w 60 file.txt
# -w = width (60 characters)80 characters:
# Default width (80)
fold file.txt
# Wraps to 80 charactersNarrow wrap:
# Narrow wrap
fold -w 40 file.txt
# 40 characters per lineWide wrap:
# Wide wrap
fold -w 120 file.txt
# 120 characters per lineNo wrapping:
# No wrapping (very wide)
fold -w 1000 file.txt
# Very wide linesCount bytes:
# Byte count (default)
fold -b -w 80 file.txt
# -b = bytes (counts bytes, not characters)Count characters:
# Character count (default)
fold -w 80 file.txt
# Counts characters (handles UTF-8)Check installation:
# fold is part of coreutils
# Usually pre-installed
# Check fold
which foldThis guide covered fold usage, line wrapping, and text folding for Arch Linux, CachyOS, and other distributions.
- fmt Guide - Text formatting
- Text Processing - Text manipulation
- sed Guide - Text processing
-
fold Documentation:
man fold
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.