LinuxCommandLibrary

bsd-from

Extract addresses from email messages

SYNOPSIS

bsd-from [-a] [-c] [-l] [-s sender] [user]

PARAMETERS

-a
    Show all messages in the mailbox, regardless of whether they have been read. Note that for many modern implementations, this is the default behavior.

-c
    Print the character count for each message listed, following the sender and date information.

-l
    Print the line count for each message listed, following the sender and date information.

-s sender
    Display only those messages that were sent by the specified sender. This allows for filtering mail summaries.

user
    Specify the username whose mailbox should be inspected. If omitted, bsd-from defaults to the current user's mailbox.

DESCRIPTION

The bsd-from command is a utility designed to quickly scan a user's mail spool file, typically located at /var/mail/$USER or /var/spool/mail/$USER, for lines indicating the sender and date of mail messages.

It parses the mailbox file for lines beginning with "From ", which are characteristic of the traditional Unix mbox mail format. This provides a concise summary of incoming mail, allowing users to see who sent messages and when, without needing to open a full mail client.

bsd-from is a re-implementation of the classic from command found on BSD Unix systems, providing compatibility and a simple command-line interface for rudimentary mail inspection. It is particularly useful in environments where mail is still delivered to local mbox files.

CAVEATS

bsd-from is primarily designed for and works best with mailboxes stored in the traditional mbox format. It may not function correctly or provide meaningful output for mailboxes using modern formats like Maildir, or for mail accessed via IMAP/POP3 clients.

It only extracts the "From " envelope line and does not display full mail headers or message bodies.

MAILBOX FORMAT DEPENDENCY

This command relies heavily on the mail spool file conforming to the mbox format, where each message starts with a line beginning "From " (with a space) followed by the sender's address and a timestamp. Without this specific format, the command may fail to parse messages correctly.

OUTPUT FORMAT

The typical output for each message is a single line resembling:
From user@example.com Mon Jan 01 12:34:56 2023
When -c or -l options are used, the character or line count will be appended to this line.

HISTORY

The bsd-from command is a Linux re-implementation of the original from command, which was a standard utility on BSD Unix systems since their early days. It served as a basic tool for users to quickly check their incoming mail. Its inclusion in Linux distributions, often as part of compatibility packages like bsd-mailx, ensures that traditional Unix scripts and workflows can continue to function, bridging the gap between older and newer system conventions. It represents a simpler era of mail management where mail was stored in plain text files directly on the system.

SEE ALSO

from(1), mail(1), mailx(1), mbox(5)

Copied to clipboard