Solved

How to delete mail I got?

Posted on 2000-03-14
4
322 Views
Last Modified: 2013-12-06
How can I  delete mail after reading , which is very very long?
0
Comment
Question by:clemend
  • 2
4 Comments
 
LVL 21

Accepted Solution

by:
tfewster earned 30 total points
ID: 2617169
If you're just using the unix command "mail" to read your mail, type "d" at the ? prompt to delete the item you've just read.

If you've got lots of old messages that you don't want to re-read and delete individually, cd to /var/mail and do "cat /dev/null > your_user_name" - This will destroy all your mail messages & leave you with an empty mail file.
0
 
LVL 5

Expert Comment

by:paulqna
ID: 2617353
Prefer this one (looks safer to me):

/ # >/var/mail/<username>

This will empty the user's mailbox.

or edit the mailfile with vi, and delete eg 500 lines with "d500".
0
 
LVL 12

Expert Comment

by:tel2
ID: 2618947
Or, if you want to delete say message numbers 5 to 600, type:
  d5-600
at mail's "?" prompt.
0
 
LVL 21

Expert Comment

by:tfewster
ID: 2619215
clemend, it would help if you told us which Unix you use, plus which mail
reader...

Assuming it's the "mail" command:
If you have lots of messages, some of which you want to keep, you can list just the headers by using "mail -h" (On AIX "mail -H", but AIX displays just the headers by default). From the list, you can select which messages to delete.

Typing "?" at the mail "?" prompt will bring up the help screen. The command "man mail" will tell you more about the command line options.


If you want to empty the whole mail file, /var/mail is the right directory for Solaris & HP-UX; On AIX it's /var/spool/mail; On further thought, you can just delete your mail file - it gets recreated correctly the next time you get mail.

paulqna, the mail file must start with a valid "From " line on Solaris, so after deleting e.g 500 lines, you should do "d/From " - Note the space after the word "From", to distinguish it from "From:" :)

tel2, AIX obviously has a more flexible mail client than the basic Solaris 2.7 client, which doesn't allow you to specify a range :(
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question