Send Mail from a Linux Command Line Prompt


Send an email from Linux command line/bash prompt.


Subject: enter a subject here
Body of your email goes here

Hit enter to go to a new line and then Ctrl-D to send your message.


It's extremely easy to send an email from a Linux shell/command line prompt. Assuming you have Postfix installed (comes with most Red Hat based distributions), you literally only need a single command to send an email. Suppose you want to mail a quick letter to


Hit enter, and you will be prompted for a subject. Type one in, hit enter again and compose the body of your email. Press Ctrl-D, or [^D, when you are done to send the message.

Your final screen will look something like this:

$ mail
Subject: Low Disk Space

It has come to our attention that your server is running low on disk space.
If you would like us to add additional drives please respond to this email with a time that works best for you.

Yours Sincerely,

Keep in mind that unless you have a fully-qualified domain name with an MX record and have set up a POP3 or an IMAP server, you will not be able to receive mail.

Was this article helpful?

mood_bad Dislike 1
mood Like 4
visibility Views: 23187
Related articles: