Question. I am running Linux system (Ubuntu) system. Its root user has 100K emails to their mailbox. How do I remove all emails from root mailbox? How can I remove all emails using shell prompt on Linux system?
This tutorial will help you delete all root user emails from the shell in Linux system. Here you will find two methods to remove user emails in Linux system with a single command.
You can simply remove all emails of root or any other user on Linux system using the following command.
echo 'd *' | mail -N
You can also empty the mailbox file for any user. Generally the Linux system keeps the email under /var/mail/root or /var/spool/mail/root (for root account).
> /var/mail/ root > /var/spool/mail/ root
For any other user on Linux system, Simply change the root with the other username.