Manage Mail

I have recently taken over a UNIX system from another programmer and am just beginning to learn UNIX.

When I enter the MAIL command, the data scrolls off the screen for five minutes. Some of it is several years old.

Can I tell the MAIL command to give me the last few items or the last few days only?

I would like to delete some of the older material? Must it be done one item at a time or can I do it by date or contents?

thank you for your help

mail displays one message at a time, so if it is scrolling for a while after you type mail, the first mail must have a binary attachment. type d after it stops to remove that message.

man is your friend

  Reading Mail
     The following command-line arguments affect reading mail:

     -e    Mail is not printed. An exit status of 0  is  returned
           if  the  user has mail; otherwise, an exit status of 1
           is returned.

     -h    A window of headers  are  initially  displayed  rather
           than  the  latest message.  The display is followed by
           the ? prompt.

     -p    All messages are printed without prompting for  dispo-
           sition.

     -P    All  messages  are  printed  with  all  header   lines
           displayed,  rather  than  the default selective header
           line display.

     -q    mail terminates after interrupts. Normally  an  inter-
           rupt  causes only the termination of the message being
           printed.

     -r    Messages are printed in first-in, first-out order.

Once in the mail program here are a few commands

     d, or dp
           Delete the current message and print the next message.

     d n   Delete message number n. Do not go on to next message.

     dq    Delete message and quit mail.

     h     Display a window of headers around current message.

     h n   Display a window of headers around message number n.

     h a   Display headers of all messages in  the  user's  mail-
           file.

     h d   Display headers of messages scheduled for deletion.

     u [ n ]
           Undelete message number n (default is last read).

     ?     Print a command summary.