LinuxCommandLibrary

biff

Notify user of incoming mail

TLDR

Print the current time in a format of your choosing

$ biff time fmt [[-f|--format]] rfc3339 now
copy

Print multiple relative times in one command
$ biff time fmt [[-f|--format]] '%c' now -1d 'next sat' 'last monday' '9pm last mon'
copy

Print the current time in another time zone, and round it the nearest 15 minute increment
$ biff time in Asia/Bangkok now | biff time round [[-i|--increment]] 15 [[-s|--smallest]] minute
copy

Convert a time between two different time zone
$ TZ='Japan' biff time in America/New_York 02:30
copy

Print a past or future time relative to current time
$ biff time add [-1d|1d|1w|-1m|1y|...] now
copy

Add a complex duration to the current time
$ biff time add '1 week, 12 hours ago' now
copy

Find the duration since a date in the past and round it to the desired precision
$ biff span since 2025-01-20T12:00 [[-l|--largest]] year
copy

Find timestamps in a log file and reformat them into your local time in place
$ biff tag lines /tmp/access.log | biff time in system | biff time fmt [[-f|--format]] '%c' | head [[-n|--lines]] 3 | biff untag [[-s|--substitute]]
copy

SYNOPSIS

biff [y | n]

PARAMETERS

y
    Enables mail notification. This tells the comsat daemon to notify you when new mail arrives.

n
    Disables mail notification. This stops comsat from sending mail alerts to your terminal.

DESCRIPTION

biff is a traditional Unix command-line utility designed to provide immediate notifications of new incoming mail. When enabled, it monitors the user's mailbox file for changes. Upon the arrival of a new email, biff prints the mail header and the first few lines of the message directly to the user's terminal, interrupting whatever they might be doing. This functionality relies on the comsat (or biff-server) daemon, which actively watches mailboxes and sends notifications. While once a popular feature for system administrators and power users on text-based terminals, biff has largely been superseded by modern graphical mail clients and notification systems that offer richer and less intrusive ways to manage email alerts. It remains available primarily for historical compatibility or in minimalist console environments.

CAVEATS

biff requires the comsat (or biff-server) daemon to be running on the system to function correctly. Without comsat, biff will not be able to provide notifications.
Notifications are printed directly to the terminal, which can be disruptive, especially if you are in the middle of editing a file or running another command.
In modern desktop environments, graphical mail clients and notification systems offer more integrated and less intrusive mail alerts, making biff less relevant for most users.
Printing mail headers and content directly to the terminal could potentially expose sensitive information to shoulder-surfers or in screen recordings.
It primarily works for local mailboxes, not typically for remote IMAP/POP3 accounts without specific server-side integration.

<B>HOW <B>BIFF</B> WORKS</B>

When you execute biff y, the biff client program sends a UDP datagram to the comsat server, typically on port 512 (biff/comsat service). This datagram includes your terminal device name. The comsat daemon then adds your terminal to its list of devices to notify. When comsat detects new mail in your mailbox file (e.g., /var/mail/$USER), it reads the mailbox, formats the notification (header and first few lines), and attempts to write this information directly to the specified terminal using write(2) or similar low-level system calls, bypassing the shell.

<B>MODERN RELEVANCE</B>

In contemporary computing environments, biff is rarely used by the average user. Modern email clients like Thunderbird, Outlook, or webmail interfaces provide rich, configurable, and often non-intrusive notifications (e.g., pop-up alerts, sound notifications, tray icons) that are far more suitable for desktop use. biff's primary utility now lies in niche scenarios, such as very minimalist console-only setups, for historical interest, or by system administrators who prefer a traditional Unix toolset.

HISTORY

biff is a venerable command tracing its origins back to early Unix systems, particularly BSD. It was designed to address the need for immediate mail notification in a time when users typically worked on text-based terminals and didn't have graphical interfaces or persistent mail clients. The command is named after a dog belonging to the developer who created it. Its reliance on the comsat (or biff-server) daemon dates back to these early implementations, where comsat would monitor /var/mail or ~/Mailbox and broadcast mail arrival information. While widely used in the 1980s and 1990s, its prominence waned with the advent of graphical user interfaces and sophisticated email clients, which offer more advanced and user-friendly notification mechanisms. Despite this, biff remains a testament to the ingenuity of early Unix developers and is still found on many systems for backward compatibility.

SEE ALSO

mail(1), comsat(8), mesg(1), write(1)

Copied to clipboard