How to view the last mail in linux
The mail instruction is too bad on the Internet. I will not repeat it again. Here I will only talk about my situation and skills.
Recently, due to linux time synchronization and crontab settings, a mail is generated every time you run the command, which contains time difference records after time synchronization, during each inspection, you need to check the time difference of the last time, but haven't cleaned up the mail files for a long time. Therefore, it takes too much trouble to find tens of thousands of mails one by one, if you can directly read the last mail, it would be better. It must be the latest mail.
It is inconvenient to directly use the z or Z command to view the subsequent emails, and it is difficult to judge the date format. Therefore, I thought of a simple method to view the latest email directly.
Run the file command to check the total number of emails.
You can use the file command to notify you of a total of 1640 emails. Normally, the last one should be the latest generated email.
Enter 1640 directly to access this mail to see if it is the latest email we need.
We can see that the email is sent at on the 31st day, which exactly matches our current date and time.
So far, let's check the fulfillment of the latest email.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.