How to Delete root User's Emails via a Shell in a Linux VPS?

Sometimes your system might face the issue of spamming and due to that root user can have a high amount of email. In this article, we will let you know to delete all root user emails from the shell in the Linux system.

Important Note: Change the name root to any other user to remove emails from any other user account. Make sure there are no other important emails as these options will remove all the emails. 

Option 1 :

Remove all root emails or any other user account on your Linux OS with the below commands.

# echo 'd *' | mail -N

Option 2 :

In Linux OS, all the emails lies under the /var/mail/root or /var/spool/mail/root. You can go to this path and remove the emails manually.

# /var/mail/root or # /var/spool/mail/root

Was this answer helpful?

« Back