Text and processing

The fmt command

Reformats paragraphs: joins the lines and splits them again to fill a uniform width.

Syntax

fmt [-w N] [archivo]

Most useful options

-w NDesired line width

Copy-ready examples

$ printf 'uno dos tres cuatro\n' | fmt -w 10Reflow to 10 columns

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Paragraphs are separated by blank lines; fmt does not merge them.

Related commands

FAQ

When to use it?

To give text uniform line length, for example an email or a README.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course