How to check mail service is running on linux

There are several ways to check if a mail service is running on a Linux system:

  1. Check the mail service status:
    • For Postfix: sudo systemctl status postfix (or sudo service postfix status on older systems)
    • For Sendmail: sudo systemctl status sendmail (or sudo service sendmail status on older systems)
    • For Exim: sudo systemctl status exim (or sudo service exim status on older systems)
  2. Check the mail service logs:
    • For Postfix: sudo journalctl -u postfix (or sudo tail -f /var/log/mail.log on older systems)
    • For Sendmail: sudo journalctl -u sendmail (or sudo tail -f /var/log/sendmail.log on older systems)
    • For Exim: sudo journalctl -u exim (or sudo tail -f /var/log/exim.log on older systems)
  3. Check the mail service process:
    • ps -ef | grep postfix (or ps -ef | grep sendmail or ps -ef | grep exim)
    • This will show you the process ID and other information about the mail service process.
  4. Check the mail service configuration:
    • sudo postconf -n (for Postfix)
    • sudo sendmail -bz (for Sendmail)
    • sudo exim -bP (for Exim)
    • These commands will show you the current configuration settings for the mail service.
  5. Check the mail service port:
    • netstat -tlnp | grep 25 (for SMTP)
    • netstat -tlnp | grep 587 (for Submission)
    • netstat -tlnp | grep 465 (for SSL/TLS)
    • These commands will show you if the mail service is listening on the specified ports.

Note: The exact commands and locations may vary depending on your Linux distribution and mail service configuration.