Ubuntu/Debian Bash: Mail: command not found (CentOS, Redhat)

You are unable to see most of the commands in your system with the nominal installation of any Linux distro. Then only the mandatory packages are install for running an OS and skipped unnecessary packages. The mail command is used in most of the Linux operating system distribution for sending emails from the command line. You’ll get the error like ‘The program mail is currently not installed.’ in most of the Debian based systems.

Install mail Command:

Let’s use one of the commands as follow to install the mail command according to your OS. For RHEL based mostly OS, this command installed from mailx rpm packages.

Install mail command on CentOS/Redhat 7/6/5:

yum install mailx

Install mail command on Fedora 22+:

 

dnf install mailx

Install mail command on Ubuntu/Debian/LinuxMint:

On Debian based operating system this command found in mailutils package.

sudo apt-get install mailutils

 

Sending Test Email

Send a test email using the following command after installing mail command packages in your system.

echo “Hello World” | mail -s “Message Subject” [email protected]