Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Commands»Bash: mail: command not found (CentOS, Redhat, Ubuntu and Debian)

    Bash: mail: command not found (CentOS, Redhat, Ubuntu and Debian)

    By RahulJune 7, 20222 Mins Read

    With the minimum installation of any Linux operating system, you will not see most of the commands in your system. In minimum operating system installation only required packages are installed for running an operating system and skipped unnecessary packages are. mail command is useful for sending emails from the Linux command line which is used for almost Linux operating systems. Most Debian-based systems will show errors like “The program ‘mail’ is currently not installed. You can install it by typing”

    Advertisement

    There are many other alternatives to mail command for sending emails from Linux command line interface.

    Installing mail Command

    Let’s use one of the below commands to install the mail command as per your operating system. For RHEL based systems, this command installed from mailx rpm packages and on Debian based system this command found in mailutils package.

    Execute one the following command based on the operating system:

    • Install mail command on CentOS/Redhat 7/6
      sudo yum install mailx 
      
    • Install mail command on Fedora 22+ and CentOS/RHEL 8
      sudo dnf install mailx 
      
    • Install mail command on Ubuntu/Debian/LinuxMint
      sudo apt-get install mailutils 
      
    • Sending Test Email

      After installing mail command packages in your system, send a test email using the below command.

      echo "Message Body" | mail -s "Message Subject" [email protected]  
      

    bash mail
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    cp Command in Linux (Copy Files Like a Pro)

    dd Command in Linux (Syntax, Options and Use Cases)

    10 Bash Tricks Every Developer Should Know

    View 6 Comments

    6 Comments

    1. Moorthy on February 15, 2021 3:43 am

      it is good if you explain how did you solved, it will help for others.

      Reply
    2. Subodh on October 18, 2020 1:46 pm

      Hi Rahul,

      I have installed AMAZON ec2-instance on which I have installed Postfix email service.

      I am not able to send emails using Postfix.

      Can you help?

      Reply
    3. Noah on March 28, 2018 2:47 pm

      I installed the package, and it’s asking for a “postfix configuration.” I can’t select anything. Help!

      Reply
      • Noah on March 28, 2018 2:47 pm

        Never mind. I solved it.

        Reply
    4. bharath on September 8, 2017 12:38 pm

      hi,
      i am not able to send mail with non root user

      Reply
      • Elias, Ederson on September 18, 2017 3:08 pm

        Mr. Bharath

        First to send some email, pleas check if you have a tiny file “.mailrc” in $HOME of this “non root user”.

        Fill the file “.mailrc” with:

        set smtp=smtp.puthereyoursmtpserver
        set ssl-verify=ignore
        set [email protected]
        set font-family:monospace

        enjoy

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.