Solved

How to delete mail I got?

Posted on 2000-03-14
4
318 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 11

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
AIX    Volume group Auto ON/OFF question 2 74
OpenLDAP Proxy to Active Directy 6 158
Sed question 2 49
Image not there 4 35
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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 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.:

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now