How to empty an users inbox

Sometimes you may have a mailbox on a linux server with several thousand items in it that you wish to clear quickly. You can do this by following the following steps.

  1. Login to putty (
  2. Change directory to the folder you wish to empty in the following format: /home/[cpanel username]/mail/[ - the part after the @ in the email]/[user - the part before the @ in the email]/[folder]/
    If you wish to clear the inbox, this is listed as "cur". Unread mail can be found in "new".
    e.g. for
    cd /home/example/mail/
  3. find . -type f -delete

If you want to change to a directory and then see what folders are available, "cd" changes directory, "ls" lists the contents, for example:

cd /home/example/mail/

This would list the available users

cd /home/example/mail/

 This would list Bob's available folders.

WARNING: linux command line has the ability to delete/break everything very quickly, especially if you login as root.

Have more questions? Submit a request