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:
- Check the mail service status:
- For Postfix:
sudo systemctl status postfix
(orsudo service postfix status
on older systems) - For Sendmail:
sudo systemctl status sendmail
(orsudo service sendmail status
on older systems) - For Exim:
sudo systemctl status exim
(orsudo service exim status
on older systems)
- For Postfix:
- Check the mail service logs:
- For Postfix:
sudo journalctl -u postfix
(orsudo tail -f /var/log/mail.log
on older systems) - For Sendmail:
sudo journalctl -u sendmail
(orsudo tail -f /var/log/sendmail.log
on older systems) - For Exim:
sudo journalctl -u exim
(orsudo tail -f /var/log/exim.log
on older systems)
- For Postfix:
- Check the mail service process:
ps -ef | grep postfix
(orps -ef | grep sendmail
orps -ef | grep exim
)- This will show you the process ID and other information about the mail service process.
- 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.
- 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.