The easiest way is to empty root or users email message file. The file is located at/var/spool/mail/root or /var/spool/mail/username location. You can read mail using mail/mailx command. It is an intelligent mail processing system, which has a command syntax reminiscent of ed with lines replaced by messages.
How to install mail command on Linux
Type the following yum command on a CentOS/RHEL to install the same:
sudo yum install mailx
Use the following dnf command on a Fedora Linux to install it:
sudo dnf install mailx
Try the following apt command/apt-get command on an Ubuntu or Debian system:
sudo apt install mailutils
How do I read my mail messages from the CLI on Linux?
Simply type the following command:
The current message is initially the first message (numbered 1) and can be printed using the print command which can be abbreviated p. Just press p. The user can move among the messages much as he moves between lines in ed, with the commands + and - moving backwards and forwards, and simple numbers. Just type 10 to read email message # 10. After viewing a message the user can delete by pressing d. To reply press r.
How to delete root user’s mailbox/inbox file in Linux or Unix
Simply type the following command at shell prompt to delete all root mail:
Verify it with the following command or cat command or ls command:
ls -l /var/spool/mail/root
How to remove root user’s email every day using cron job
Simply run the following cron job:
@daily > /var/spool/mail/root