Skip to content

Linux fold Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux fold Guide

Complete beginner-friendly guide to fold on Linux, covering Arch Linux, CachyOS, and other distributions including line wrapping, text folding, and width limiting.


Table of Contents

  1. fold Basics
  2. Line Wrapping
  3. Width Control
  4. Byte vs Character
  5. Troubleshooting

fold Basics

Wrap Lines

Basic usage:

# Wrap lines
fold file.txt

# Wraps to default width (80)

Custom Width

Set width:

# Custom width
fold -w 60 file.txt

# -w = width (60 characters)

Line Wrapping

Default Width

80 characters:

# Default width (80)
fold file.txt

# Wraps to 80 characters

Narrow Lines

Narrow wrap:

# Narrow wrap
fold -w 40 file.txt

# 40 characters per line

Width Control

Wide Lines

Wide wrap:

# Wide wrap
fold -w 120 file.txt

# 120 characters per line

No Limit

No wrapping:

# No wrapping (very wide)
fold -w 1000 file.txt

# Very wide lines

Byte vs Character

Byte Count

Count bytes:

# Byte count (default)
fold -b -w 80 file.txt

# -b = bytes (counts bytes, not characters)

Character Count

Count characters:

# Character count (default)
fold -w 80 file.txt

# Counts characters (handles UTF-8)

Troubleshooting

fold Not Found

Check installation:

# fold is part of coreutils
# Usually pre-installed

# Check fold
which fold

Summary

This guide covered fold usage, line wrapping, and text folding for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally