How to Read Mail in Linux Command Line Terminal – “You have mail”


When I first logged into the command line of my Linux container (LXC) for Pi-hole, there was a message in the terminal that said I had mail. That seemed strange to me because I had just created the LXC and had not setup anything for emails.

After some digging, I learned that “You have mail” indicates there is a message in my spool file, and it can be opened with a text editor or displayed with the cat or less command. Any one of these commands should display your “mail”:

sudo cat /var/mail/$(whoami)
sudo less /var/mail/$(whoami)
sudo nano /var/mail/$(whoami)

The “mail” turned out to be some error messages from Pi-hole not being able to resolve some names.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.