Linux fmt Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
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
- 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.