Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to delete mail I got?

Posted on 2000-03-14
4
321 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 20

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 20

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX  NFS  question 1 152
Compare if date string is within text file 3 63
text in table need to be center of the box 4 81
Install MySQL 5.6 and PHP on Centos Linux 6 137
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

840 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