Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»Delete All root User Emails from a Shell in Linux

    Delete All root User Emails from a Shell in Linux

    By RahulMarch 5, 20201 Min Read

    Question. I am running a Linux system (Ubuntu) system. Its root user has 100K emails to their mailbox. How do I remove all emails from the root mailbox? How can I remove all emails using shell prompt on Linux system?

    Advertisement

    This tutorial will help you delete all root user emails from the shell in the Linux system. Here you will find two methods to remove user emails in a Linux system with a single command.

    Method 1:

    You can simply remove all emails of root or any other user on the Linux system using the following command.

    echo 'd *' | mail -N
    

    Method 2:

    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 the Linux system, Simply change the root with the other username.

    Email linux mailbox mbox root shell
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Validate Email Addresses in Python (Using Regular Expressions)

    Understanding 2>&1 in Bash: A Beginner’s Guide

    How to Choose the Best Shebang (#!) for Your Shell Scripts

    View 2 Comments

    2 Comments

    1. tom on May 21, 2019 8:54 am

      Thanks for such a beautiful post, very informative and useful article

      Reply
    2. Asus Support on September 18, 2018 8:54 am

      Sometimes I first run commands by hand (on a test system) to find out the right ones, the right order, etc. In cases, I find it useful to automatically document what I type and be able to ‘replay’ it later on.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Python Lambda Functions – A Beginner’s Guide
    • 10 Practical Use Cases for Lambda Functions in Python
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.