# How to delete mails?



## Nokobon (Jun 5, 2009)

Hello,
sorry for that really dump question. I know it should be solved easily by reading the documentation, but just can not figure it out.
I have some mails in the mailbox of my root account and I`d like to delete them.
The help, as well as the man-page, of the "mail"-utility says mails can be deleted with 
	
	



```
d <message list>
```
But what do I have to insert as <message list>?
The help says it consists of integers, ranges of same or user names...
This doesn`t really help me, since I still don`t know what to enter...

Any hints for me? 

Thanks,
Nokobon


----------



## SirDice (Jun 5, 2009)

Type h to see a list of messages. The numbers in front are the ones you need to put after d.

It's probably simpler to install mail/mutt or mail/pine4.


----------



## DutchDaemon (Jun 5, 2009)

```
Specifying Messages
     Commands such as print and delete can be given a list of message numbers
     as arguments to apply to a number of messages at once.  Thus ``delete 1
     2'' deletes messages 1 and 2, while ``delete 1-5'' deletes messages 1
     through 5.  The special name `*' addresses all messages, and `$'
     addresses the last message; thus the command top which prints the first
     few lines of a message could be used in ``top *'' to print the first few
     lines of all messages.
```


----------



## Nokobon (Jun 5, 2009)

Thank you very much!
@DutchDaemon:
Where did you get that documentation from?
It`s much better than the man-page...


----------



## DutchDaemon (Jun 5, 2009)

Uhmm, from the man page .. mail(1).


----------



## Nokobon (Jun 5, 2009)

DutchDaemon said:
			
		

> Uhmm, from the man page .. mail(1).



D'oh!
That's embarassing... xD
I only read the "delete"-part.

By the way...after restarting the mail-programm, the deleted mails are there again.
Why?
I want to delete them constantly.


----------



## DutchDaemon (Jun 5, 2009)

Are you using exit/x or quit/q? See the man for differences.


----------



## Nokobon (Jun 5, 2009)

I used exit before...

Thanks for your help!


----------



## DutchDaemon (Jun 6, 2009)

If you plan on doing a lot of command-line mail reading, I advise you to get a console-based mail program, as suggested above, e.g . mail/alpine or mail/mutt, or have your email forwarded to a place where you have POP3/IMAP/webmail access, of course.


----------



## vivek (Jun 6, 2009)

Another dirty shortcut w/o typing much is

```
>$MAIL
```
OR

```
>/var/mail/$USER
```
Above two are bash specific, csh:

```
echo > $MAIL
```


----------

