oreilly.comSafari Books Online.Conferences.


Linux in a Nutshell

This directory of Linux commands is from Linux in a Nutshell, 5th Edition.

Click on any of the 687 commands below to get a description and list of available options. All links in the command summaries point to the online version of the book on Safari Bookshelf.

Buy it now, or read it online on Safari Bookshelf.


formail [options]

Filter standard input into mailbox format. Useful for splitting mail digests or passing the contents of a mail file to another program, such as a spam filter, for additional processing. If no sender is apparent, provide the sender foo@bar. By default, escape bogus From lines with >.



Do not split first skip messages.


Stop after splitting total messages.

-a headerfield

Append headerfield to header, unless it already exists. If headerfield is Message-ID or Resent-Message-ID with no contents, generate a unique message ID.


Do not escape bogus From lines.


When header fields are more than one line long, concatenate the lines.


Do not assume that input must be in strict mailbox format. This option disables recognition of the Content-Length field so you can split digests or use nonstandard mailbox formats.


Allow messages to begin one immediately after the other; do not require empty space between them.


Do not edit non-mailbox-format lines. By default, formail prepends From to such lines.

-i headerfield

Append headerfield whether or not it already exists. Rename each existing headerfield to Old-headerfield, unless it is empty.


For use only with-r. Keep the body as well as the fields specified by -r.

-m minfields

Require at least this many minfields before recognizing the beginning of a new message. Default is 2.


Allow simultaneous formail processes to run.

-p prefix

Escape lines with prefix instead of >.


Do not display write errors, duplicate messages, and mismatched Content-Length fields. This is the default; use -q- to turn it off.


Throw away all existing fields, retaining only X-Loop, and generate autoreply header instead. You can preserve particular fields with the -i option.


Must be the last option; everything following it will be assumed to be its arguments. Divide input to separate mail messages, and pipe them to the program specified or concatenate them to standard output (by default).


Assume sender's return address to be valid. (By default, formail favors machine-generated addresses.)

-u headerfield

Delete all but the first occurrence of headerfield.

-x headerfield

Display the contents of headerfield on a single line.


When necessary, add a space between field names and contents. Remove ("zap") empty fields.

-A headerfield

Append headerfield whether or not it already exists.


Assume that input is in BABYL rmail format.

-D maxlen idcache

Remember old message IDs (in idcache, which will grow no larger than approximately maxlen). When splitting, refuse to output duplicate messages. Otherwise, return true on discovering a duplicate. With -r, look at the sender's mail address instead of the message ID.

-I headerfield

Append headerfield whether or not it already exists. Remove existing fields.

-R oldfield newfield

Change all fields named oldfield to newfield.

-U headerfield

Delete all but the last occurrence of headerfield.


Format in traditional Berkeley style (i.e., ignore Content-Length fields).

-X headerfield

Display the field name and contents of headerfield on a single line.

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: