countmail
Mailbox message counter
TLDR
Count messages in the default mailbox
SYNOPSIS
countmail [options] [mailbox...]
DESCRIPTION
countmail is a simple utility for counting messages in mailboxes. It supports both traditional mbox format files and Maildir directories, automatically detecting the format when possible.
The tool is useful for status bars, scripts, and notifications that need to display unread mail counts. It can process multiple mailboxes and output results suitable for parsing by other programs.
countmail reads mailbox headers efficiently without loading entire messages, making it fast even for large mailboxes. It can distinguish between read and unread messages based on standard mail flags.
PARAMETERS
MAILBOX
Path to mailbox file or Maildir to count. Uses default mailbox if omitted.--unread
Count only unread messages.--read
Count only read messages.--quiet
Output only the number, no labels.--mbox
Treat the path as mbox format.--maildir
Treat the path as Maildir format.-h, --help
Display help information.
CAVEATS
Mailbox format detection may fail for unusual configurations; use explicit --mbox or --maildir flags when needed. File locking is not performed, so counts may be slightly off if the mailbox is being modified concurrently.
HISTORY
countmail is part of the tradition of simple Unix mail utilities. Various implementations exist to provide this basic functionality, often as part of larger mail handling toolkits or as standalone scripts for desktop integration.
