Technology Insights

Delete All Mail Using the mail Command From the CLI of a Linux Server

Deleting mail from a Linux users local account is easy using the mail command line utility. The mail command can also be used to perform any other functions that you can think of to manage email such as replying to messages, reading messages, or just sending messages. It is very basic in nature but it does provide a great utility for simple mail tasks.

Typically most of the mail that ends up in a user account on a Linux server that I might manage comes from a cronjob or some various task that is run on a server under a users name. It is important to understand and review these messages from time to time as they may have important information in them.