Email Results from the Command Line

If you have ever wanted to email yourself the results of commands you have run from the Linux Command Line, it is very easy.  This is especially great for reports.  All you need to do is make sure that sendmail on your box is setup to send mail and then you can just pipe your command to the mail command like below:

ls -lta | mail -s “LS of Directory” [email protected]

That will send an email to [email protected] with the subject of “LS of Directory” and it will have the results of the ls -lta on that directory.

This entry was posted in Guides, Linux. Bookmark the permalink.

Leave a Reply