Delete a range of email messages using the 'mail' command

While mail may not be able to, and you don't have pine or mutt you probably do have mailx. And mailx can d 5-10 or d *.


If you want to execute a d 1 through d 100, you could generate that sequence of commands and pipe it directly to mail:

i=1; while [ $i -le 100 ]; do echo d $i; i=$(($i+1)); done | mail

The following will help you to read the mails during 1 second, delete the mail and move on to the next one. If all mails have been deleted loop will stop.

Want some more time? Change sleep to 2 or more. Want it faster? Replace sleep 1 by a dummy command.

while (echo dq |mail) do sleep 1 ;done