Thursday, October 9, 2014

Delete all mails or selected mails in mbox in Linux Ubuntu

Every time you read a mail with the mail command in Linux terminal and you don't delete the mail - those read mails will be stored in an mbox-file located to /root/mbox (if root is the user). This file can get pretty big depending on how many e-mails you leave undeleted.

To view and delete all those in mbox you do this:
mail -f
d *
Where you tell with the -f flag to read all your stored emails and then followed by a delete command and the asterix (*) means everything. If you would like to just delete selected mails from your mbox you write d then followed by the mail number. E.g. I want to delete message number 15 from my mbox:
mail -f
d 15

No comments:

Post a Comment