-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux fmt Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to fmt on Linux, covering Arch Linux, CachyOS, and other distributions including text formatting, line wrapping, and paragraph formatting.
Basic usage:
# Format text
fmt file.txt
# Formats text to default width (75 chars)Pipe input:
# Format from input
echo "Long line of text here" | fmt
# Wraps text to default width75 characters:
# Default width (75)
fmt file.txt
# Wraps to 75 characters per lineSet width:
# Custom width
fmt -w 60 file.txt
# -w = width (60 characters)Narrow lines:
# Narrow format
fmt -w 40 file.txt
# 40 characters per lineWide lines:
# Wide format
fmt -w 100 file.txt
# 100 characters per lineKeep paragraphs:
# Preserve paragraphs
fmt -p ">" file.txt
# -p = prefix (preserves lines with prefix)Uniform spacing:
# Uniform spacing
fmt -u file.txt
# -u = uniform (uniform spacing)Check installation:
# fmt is part of coreutils
# Usually pre-installed
# Check fmt
which fmtThis guide covered fmt usage, text formatting, and line wrapping for Arch Linux, CachyOS, and other distributions.
- fold Guide - Line wrapping
- Text Processing - Text manipulation
- sed Guide - Text processing
-
fmt Documentation:
man fmt
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.