Reformat paragraphs

The fmt command in Linux is used to reformat paragraphs in a text file. It is useful in situations when you have a file with long or irregular line lengths. The fmt command helps you clean up the file by producing the balanced output with lines similar in length. If not specified otherwise, fmt will create text to a width of 75 characters wide.

Here is an example text:

fmt example

Notice how the lines are of different lengths. We can use the fmt command to reformat the paragraphs:

fmt command example

You can change the width with the -w option:

fmt command change width

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019