Welcome to bytebang » The blog about all and nothing » Delete all emails in mutt

Delete all emails in mutt

May 02 2020

The Problem

I am running several Linux servers and thereon are a few cron jobs. I like to configure these cornjobs to send me an email with the result as soon as they are finished. (Which can be done by prepending a MAILTO=“recipient@adress.tld“ in the crontab)

However, if there are jobs which are running frequently then you may get a lot of emails in your local inbox. Since i am using mutt (a local command line email client) for checking my mails.


You see - 14440 new messages. If you want to delete them by pressing d for each message then this will take a time till you have paged through all messages. There must be a better solution ...

The Solution

Mutt lets you delete messages by a regex pattern. Here is how you do it:

  1. Press D (capital letter) -> This enters the mode where you can enter your regex
  2. Enter your regular expression: ~s .*
  3. Press q to quit mutt and accept that you want to delete the messages.


E voila - the messages are gone.

Get Social

(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen