Linux Administrator

How to Delete All Root User’s Emails Using Command Line in Linux

If you are a Linux user and if there are lots of emails on root mailbox. This article will help you to remove all emails from root mailbox.

In this article I will show how you can remove all root user emails using command line. I will provide you two methods to remove user emails in Linux system using single command.

Method #1

Using below command you can simply delete all emails of root user or any other user on Linux system.

# echo 'd *' | mail -N

Method #2

Using second method you can empty the root mailbox file or any user mailbox file. Follow the below command to empty the root mailbox file.

# cp /dev/null /var/spool/mail/root
Alternatively 
# > /var/spool/mail/root

If you want to delete other users mailbox just replace the root user with other username.

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment