Fmt (Unix)
   HOME

TheInfoList



OR:

The command in
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
, Plan 9,
Inferno Inferno may refer to: * Hell, an afterlife place of suffering * Conflagration, a large uncontrolled fire Film * ''L'Inferno'', a 1911 Italian film * Inferno (1953 film), ''Inferno'' (1953 film), a film noir by Roy Ward Baker * Inferno (1973 fi ...
, and
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s is used to format
natural language In neuropsychology, linguistics, and philosophy of language, a natural language or ordinary language is any language that has evolved naturally in humans through use and repetition without conscious planning or premeditation. Natural languages ...
text for humans to read.


Overview

The
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
has been traditionally used to reformat email messages after composition and prior to delivery. Its syntax is similar among various Unixes, but not identical. attempts to break, fill and join input lines to produce globally optimal, balanced output with the lengths of each line approaching the target width as closely as possible, rather than wrapping the input lines exactly as (from
GNU Core Utilities The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...
) does. In most implementations of , the
word wrap Line breaking, also known as word wrapping, is breaking a section of text into lines so that it will fit into the available width of a page, window or other display area. In text display, line wrap is continuing on a new line when a line is ful ...
optimization procedure usually requires two criteria: the target output line width, and the maximum acceptable line width (which should be larger than the previous one to give room for optimization). It might be not always possible to give these two options simultaneously. For example, early versions of
GNU GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
can only accept the maximum width option, which is given by switch, or directly as the first command line option for compatibility (later versions use to specify the goal width and for the maximum width). See the
Solaris Solaris may refer to: Arts and entertainment Literature, television and film * ''Solaris'' (novel), a 1961 science fiction novel by Stanisław Lem ** ''Solaris'' (1968 film), directed by Boris Nirenburg ** ''Solaris'' (1972 film), directed by ...
man page for and
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
manual entry for for detailed examples, and compare with the latest documentation of GNU utility included by most
Linux distributions A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
. See also the Plan 9
man page A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and ev ...
. Unlike , has no Unicode support, and does not support text justification. The command is available as a separate package for
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
as part of the
UnxUtils UnxUtils is a collection of ports of common GNU Unix-like utilities to native Win32, with executables only depending on the Microsoft C- runtime msvcrt.dll. The collection was last updated externally on April 15, 2003, by Karl M. Syring. The mo ...
collection of
native Native may refer to: People * Jus soli, citizenship by right of birth * Indigenous peoples, peoples with a set of specific rights based on their historical ties to a particular territory ** Native Americans (disambiguation) In arts and entert ...
Win32 The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
ports A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as H ...
of common GNU Unix-like utilities.


Example

Given text like this as input:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur dignissim
venenatis pede. Quisque dui dui, ultricies ut, facilisis non, pulvinar non. Duis quis arcu a purus volutpat iaculis. Morbi id dui in diam ornare
dictum. Praesent consectetuer vehicula ipsum. Praesent tortor massa, congue et,
ornare in, posuere eget, pede.

Vivamus rhoncus. Quisque lacus. In hac habitasse platea dictumst. Nullam mauris
tellus, sollicitudin non, semper eget, sodales non, pede. Phasellus varius
ullamcorper libero. Fusce ipsum lorem, iaculis nec, vulputate vitae, suscipit
vel, tortor. Cras varius.

Nullam fringilla pellentesque orci. Nulla eu ante pulvinar velit rhoncus
lacinia. Morbi fringilla lacus quis arcu. Vestibulum sem quam, dapibus in,
fringilla ut, venenatis ut, neque.
After passing this through , the width of each line is at most 50 characters and the text flows within this constraint:
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Curabitur dignissim venenatis
pede. Quisque dui dui, ultricies ut, facilisis
non, pulvinar non, purus. Duis quis arcu a
purus volutpat iaculis. Morbi id dui in diam
ornare dictum. Praesent consectetuer vehicula
ipsum. Praesent tortor massa, congue et, ornare
in, posuere eget, pede.

Vivamus rhoncus. Quisque lacus. In hac
habitasse platea dictumst. Nullam mauris tellus,
sollicitudin non, semper eget, sodales non,
pede. Phasellus varius ullamcorper libero. Fusce
ipsum lorem, iaculis nec, vulputate vitae,
suscipit vel, tortor. Cras varius.

Nullam fringilla pellentesque orci. Nulla eu ante
pulvinar velit rhoncus lacinia. Morbi fringilla
lacus quis arcu. Vestibulum sem quam, dapibus in,
fringilla ut, venenatis ut, neque.


See also

*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...
* *


References


External links

* * {{Core Utilities commands Unix text processing utilities Plan 9 commands Inferno (operating system) commands