Skip to content

Linux fmt Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux fmt Guide

Complete beginner-friendly guide to fmt on Linux, covering Arch Linux, CachyOS, and other distributions including text formatting, line wrapping, and paragraph formatting.


Table of Contents

  1. fmt Basics
  2. Text Formatting
  3. Line Width
  4. Paragraph Formatting
  5. Troubleshooting

fmt Basics

Format Text

Basic usage:

# Format text
fmt file.txt

# Formats text to default width (75 chars)

From Input

Pipe input:

# Format from input
echo "Long line of text here" | fmt

# Wraps text to default width

Text Formatting

Default Width

75 characters:

# Default width (75)
fmt file.txt

# Wraps to 75 characters per line

Custom Width

Set width:

# Custom width
fmt -w 60 file.txt

# -w = width (60 characters)

Line Width

Narrow Format

Narrow lines:

# Narrow format
fmt -w 40 file.txt

# 40 characters per line

Wide Format

Wide lines:

# Wide format
fmt -w 100 file.txt

# 100 characters per line

Paragraph Formatting

Preserve Paragraphs

Keep paragraphs:

# Preserve paragraphs
fmt -p ">" file.txt

# -p = prefix (preserves lines with prefix)

Uniform Spacing

Uniform spacing:

# Uniform spacing
fmt -u file.txt

# -u = uniform (uniform spacing)

Troubleshooting

fmt Not Found

Check installation:

# fmt is part of coreutils
# Usually pre-installed

# Check fmt
which fmt

Summary

This guide covered fmt usage, text formatting, and line wrapping 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