Network

The mail command

Sends an email from the command line (with -s the subject).

Syntax

mail -s <asunto> <destinatario>Try it in the terminal →

Most useful options

-sMessage subject

Copy-ready examples

$ sudo systemctl start postfixStart the mail server
$ mail -s "Hola" alumnoSend an email
$ cat /var/mail/alumnoRead the mailbox

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • If postfix is not active, mail warns that the mail system is not running.

Related commands

FAQ

What does mail do?

It sends mail from the command line and reads local mailboxes.

How do I send a message?

mail -s subject recipient; then type the body.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course