Solaris Advanced User's Guide

Deleting (and Undeleting) Messages

After you have read a message, you might decide to delete it rather than save it to your mbox file. A save to the mbox file is the default when you quit the mailx program.

To delete the last message you read, just type d at the mailx prompt. To delete a specific message from your mailbox, use the command form:

d number

For example, to delete the second message, use this command from within mailx:

& d 2

You can also delete several messages at a time. To delete messages 1 and 3, use the command:

& d 1 3

To delete a range of messages, for example 1 through 3, use the command:

& d 1-3

Before you quit mailx, you can undelete messages you've removed from your mailbox. Use the command form:

u number

followed by Return. For example, to undelete the second message, use this command:

& u 2

To undo your last deletion, just type u at the mailx prompt immediately after the deletion. For example, if your last deletion command was d 2-5, type u to undelete messages 2, 3, 4, and 5.

Note that all deletions are made permanent when you quit mailx with the q command. That is, you can no longer undelete messages that have been deleted. You can, however, quit mailx with the x command and leave your mailbox intact. As mentioned previously, if you quit with x you leave read messages marked with a U, deleted messages undeleted, and so forth.