-bash: mail: command not found

When trying to use the mail command in linux you may get the following error:

echo test | mail user@mail.address.com -s "test email"
-bash: mail: command not found

This means that the mail command is not present your system. You can install it using

yum install mailx

The mailx package is an enhanced version of the mail command. You should now be able send mail via the linux command line using a similar syntax to the example above.

This is a very useful feature if you want to send yourself automated messages after some specific action. One can also cat the contents of a file through the mail command. Combine this technique with a shell script and cron to give you insight into your automated tasks.

Be the first to comment

Leave a Reply