vicker313 tech blog

June 28, 2010

How to Purge Emails at Linux Server using Command

Filed under: Linux, Server — Tags: , — vicker313 @ 12:53 pm

All the mails are stored in files at /var/mail, where each user will have their owned individual file. For example user James’ email will be stored at /var/mail/james. To purge all emails of a user, simply clear the content of the file using the following command:

cat /dev/null > /var/mail/james

Do not remove the file, or else the user will not able to receive email anymore. However by any change the file is removed, simple recreate back the file:

cat /dev/null > /var/mail/james

chown james:mail /var/mail/james

Blog at WordPress.com.