Forrest logo
tool overview
On this page you find all important commands for the CLI tool fmt. If the command you are looking for is missing please ask our AI.

fmt

The fmt command line tool is used for formatting text files in Unix-like operating systems. It is part of the GNU Core Utilities package. This tool allows users to reformat text files by adjusting line breaks and word wrapping. It can automatically format text to a specified number of characters per line or a specific line length. The fmt command applies various algorithms to achieve optimal text formatting, ensuring readability and consistency. It supports options like "-w" to specify a specific line width and "-s" to preserve single spacing. The default behavior of fmt is to rearrange lines and wrap the text to fill the specified line width. It can be used to format plain text files, email bodies, and source code. The fmt command can be combined with other command line tools like cat or echo to process text input from files or pipelines.

List of commands for fmt:

  • fmt:tldr:53655 fmt: Reformat a file.
    $ fmt ${filename}
    try on your machine
    explain this command
  • fmt:tldr:bcc2d fmt: Reformat a file producing output lines of (at most) `n` characters.
    $ fmt -w ${n} ${filename}
    try on your machine
    explain this command
  • fmt:tldr:c42be fmt: Reformat a file without joining lines shorter than the given width together.
    $ fmt -s ${filename}
    try on your machine
    explain this command
  • fmt:tldr:d9026 fmt: Reformat a file with uniform spacing (1 space between words and 2 spaces between paragraphs).
    $ fmt -u ${filename}
    try on your machine
    explain this command
tool overview