LinuxCommandLibrary

bsd-from

Extract addresses from email messages

SYNOPSIS

from [-s sender] [-n count] [file]

PARAMETERS

-s sender
    Print only messages sent by sender (exact match on envelope address).

-n count
    Limit output to at most count matching messages.

DESCRIPTION

The from command, a BSD Unix utility, extracts and prints the sender's address from each message in an mbox-format mail file. It identifies messages by scanning for envelope lines starting with "From ", a traditional delimiter in Unix mail spools.

By default, from processes the named file or standard input, outputting one sender per line. This makes it ideal for quick overviews of mail queues or user mailboxes without launching a full reader like mail or mutt.

Key strengths include speed and simplicity for parsing legacy mail formats. However, it relies on strict adherence to mbox conventions, ignoring modern formats like Maildir. On Linux systems, it's typically in the bsdmainutils package, preserving BSD compatibility.

Use cases span mail system administration, scripting log reviews, and historical mail analysis. While powerful for its era, pair it with tools like grep or formail for complex filtering to handle evolved mail standards.

CAVEATS

Assumes traditional mbox format with "From " delimiters; fails on Maildir or non-standard mail. Deprecated for modern use; prefer formail or mu. No UTF-8 support in older versions.

EXAMPLES

from /var/mail/user
Print all senders in user's mailbox.

from -s root -n 10 /var/log/maillog
List up to 10 messages from root.

EXIT STATUS

0 on success; >0 if no matches or errors occur.

HISTORY

First appeared in 4.2BSD (1983) as part of early Unix mail tools. Ported to Linux via bsdmainutils; minimally evolved since 1990s, focusing on compatibility.

SEE ALSO

formail(1), mail(1), grep(1), mbox(5)

Copied to clipboard