Mail Command Installation On Redhat, CentOS, Fedora, Ubuntu and Debian System
Most of commands you will not see in Linux operating system if you have installed minimum installation. If you have minimum operating system installation you will get only required packages on the system and it skipped all unnecessary packages. Mail command is one of them which is used for sending mail from Linux command line. In this tutorial I am going to explain how we can install mail command on Redhat, CentOS, Fedora, Ubuntu and Debian system.
You can also find many other alternative of mail command which is used for sending mail form Linux command line like sendmail and mutt etc. but I thing mail command is more popular.
MAIL COMMAND INSTALLATION
Follow the below Linux command to install mail command on Linux system.
Mail command installation on Redhat/CentOS and Fedora systems:
#yum install mailx
You will get some output like below:
Loaded plugins: priorities, update-motd, upgrade-helper Resolving Dependencies --> Running transaction check ---> Package mailx.x86_64 0:12.4-8.8.amzn1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================================================ Installing: mailx x86_64 12.4-8.8.amzn1 amzn-main 254 k Transaction Summary ================================================================================================================================================================ Install 1 Package Total download size: 254 k Installed size: 451 k Is this ok [y/d/N]: y Downloading packages: mailx-12.4-8.8.amzn1.x86_64.rpm | 254 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mailx-12.4-8.8.amzn1.x86_64 1/1 Verifying : mailx-12.4-8.8.amzn1.x86_64 1/1 Installed: mailx.x86_64 0:12.4-8.8.amzn1 Complete!
Mail command installation on Ubuntu and Debian systems:
#apt-get install mailutils
Mail command has been installed successfully on your Linux system. Now check it is working or not.
SENDING MAIL FORM LINUX COMMAND LINE
Follow the below command to send mail from your Linux command line.
# echo "Type Message Body Here" | mail -s "Type Message Subject Here" [email protected]
You will get a mail in your receiver mail inbox like below.
I hope this article will be helpful to install Mail Command On Redhat, CentOS, Fedora, Ubuntu and Debian System . Read our another article IoT – A Beginner’s Guide to know about Internet of Things and Awstats – Log Analyzer To Analize Apache Logs On CentOS,Fedora and RHEL System . If you have any queries and problem please comment in comment section or you can also ask your question.