mail to all users on a system (from root)

Mike Meyer mwm-dated-1050675195.c62900 at
Sun Apr 13 07:13:17 PDT 2003

In <007a01c301b8$c329c290$3800000a at LAPDANCE>, Aslak Evang <nyogtha at> typed:
> I've searched for ways for root to email all users on a system. The only
> easy solution I found included making a shellscript and setting it as an
> alias for "everybody". Problem was that in the script you had to insert
> all your users manually.
> Does anybody know of other methods for sending announcements to all
> users on a system? Could have done it with MOTD but few of them actually
> log-in. Most just read mail.
> suggestions?

Two methods:

If all users have home directories in /home - or similar:
# cd /home
# mail *

Alternatively, you can send mail to everyone with something like this:

# mail $(awk -F: '$3 > 1000 { print $1 }' /etc/passwd)

I notice that zsh does autocompletion against /etc/passwd for the mail
command. Unfortunately, it still globs against files. Oh well.

Mike Meyer <mwm at>
Independent Network/Unix/Perforce consultant, email for more information.

More information about the freebsd-questions mailing list