LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

countmail

counts messages in a mailbox

TLDR

Count messages in the default mailbox
$ countmail
copy
Count messages in a specific mailbox file
$ countmail [/var/mail/user]
copy
Count messages in a Maildir
$ countmail [~/Maildir]
copy
Show unread message count only
$ countmail --unread
copy
Display count for multiple mailboxes
$ countmail [mailbox1] [mailbox2]
copy
Output in machine-readable format
$ countmail --quiet [mailbox]
copy

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.

SEE ALSO

mail(1), from(1), mutt(1), fetchmail(1), procmail(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid