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:
Notice how the lines are of different lengths. We can use the fmt command to reformat the paragraphs:
You can change the width with the -w option: