Useful CLI commands for managing PowerMTA and auxiliary services
🔧 System
service pmta restart
— restart PowerMTApmta reload
— reload configuration without stopping the servicepmtahttp restart
— restart PowerMTA web interfaceservice pmta start
— start PowerMTApmtad --debug
— debug mode for troubleshootingpmta reset counters
— reset statistics counterspmta show status
— check current service status
📤 Mailing
pmta pause queue domain.com/vmta
— pause sending for a specific VMTApmta pause queue */*
— pause all queuespmta pause queue domain.com/*
— pause by domainpmta pause queue */vmta
— pause by VMTApmta resume queue domain.com/vmta
— resume for a specific VMTApmta resume queue */*
— resume all queuespmta resume queue domain.com/*
— resume by domainpmta set queue --mode=normal domain.com/vmta
— disable backoff mode for VMTApmta set queue --mode=normal */*
— disable backoff mode for allpmta delete --queue=gmail.com/*
— delete queue by domainpmta delete --queue=*/vmta
— delete queue by VMTApmta delete --queue=*/*
— clear all queues
📊 Statistics
pmta list --queue=gmail.com
— all queues for Gmailpmta list --queue=*/*
— all queuespmta show queues
— detailed queue informationpmta show disabled sources
— list of all blocked IPspmta show disabled sources domain.com/*
— blocks by domainpmta show disabled sources */vmta
— blocks by VMTApmta show domains
— list of all recipient domainspmta show topdomains
— most active domainspmta show topqueues
— queues with highest loadpmta show vmtas
— status of all VMTAs
⚙️ Domain Settings
pmta show settings domain
— basic settings of all domainspmta show settings gmail.com/*
— settings of a specific domain
📁 Other
show version
— PowerMTA versionpmta show registration
— registration statuspmta show license
— license information
🔧 System
systemctl restart postfix
— restart Postfix servicesystemctl start postfix
— start Postfix servicesystemctl stop postfix
— stop Postfix servicesystemctl status postfix
— check service statuspostfix reload
— reload configuration without stopping the servicepostfix check
— check configuration for errorspostconf -n
— show only modified settingspostconf -d
— show all default parameters
📤 Mailing
sendmail user@example.com
— send an email manually (body typed after execution)mailq
— list emails in the queuepostqueue -p
— same as mailqpostqueue -f
— immediately process the queuepostqueue -s domain.com
— send messages only for the specified domain
🛠 Diagnostics & Logs
tail -f /var/log/mail.log
— view mail log in real timegrep postfix /var/log/mail.log
— filter log for Postfix entriesgrep -i "status=" /var/log/mail.log
— check email delivery statusespostfix -v start
— start Postfix in verbose/debug mode
📦 Queue Management
postsuper -d ALL
— delete all messages in the queuepostsuper -d queue_id
— delete a specific messagepostsuper -r queue_id
— requeue a specific messagepostsuper -r ALL
— requeue all messagespostsuper -s
— check and clean up "dead" messages from the queue
⚙️ Other
newaliases
— rebuild alias database (after editing /etc/aliases)postalias /etc/aliases
— alternative to newaliasespostmap /etc/postfix/filename
— generate hash map from a config filepostfix set-permissions
— set correct permissions (rarely used)postfix upgrade-configuration
— upgrade old configs to the new format
🔧 System
systemctl start dovecot
— start the Dovecot servicesystemctl stop dovecot
— stop the Dovecot servicesystemctl restart dovecot
— restart Dovecotsystemctl reload dovecot
— reload configuration without stoppingsystemctl status dovecot
— check Dovecot service statusdoveconf
— output the full Dovecot configurationdoveconf -n
— output only non-default (customized) parameters
🛠 Diagnostics & Logs
tail -f /var/log/mail.log
— view mail server logs in real time (usually includes Dovecot)journalctl -u dovecot -f
— view Dovecot logs via systemd in real timedoveadm log find
— search for errors in Dovecot logs (requires doveadm logging enabled)doveadm debug
— start Dovecot in debug mode (for testing)
👤 User Management
doveadm user '*'
— list all usersdoveadm user user@example.com
— show info for a specific userdoveadm mailbox list -u user@example.com
— list mailboxes for the user
📨 Mail Operations
doveadm quota get -u user@example.com
— show the user's quotadoveadm expunge -u user@example.com mailbox INBOX savedbefore 30days
— delete emails older than 30 days from INBOXdoveadm fetch savedate mailbox INBOX all
— show saved date of all emails in INBOX
⚙️ Other
doveadm auth test user@example.com password
— test user authentication with a given passworddoveadm ssl generate
— generate an SSL certificate for Dovecot (if not using an external one)doveadm config get
— get values of specific configuration parameters
🔧 System
systemctl start fail2ban
— Start Fail2bansystemctl stop fail2ban
— Stop Fail2bansystemctl restart fail2ban
— Restart Fail2bansystemctl status fail2ban
— Check Fail2ban status
🚫 Ban Management
fail2ban-client status
— General Fail2ban statusfail2ban-client status <jail_name>
— Status of a specific jailfail2ban-client set <jail_name> banip <IP_address>
— Manually ban an IPfail2ban-client set <jail_name> unbanip <IP_address>
— Unban an IPfail2ban-client reload
— Reload configuration
🕵️♂️ Diagnostics
journalctl -u fail2ban -f
— View logs in real timefail2ban-client ping
— Check if the daemon is running
▶️ Start and Stop
systemctl start spamassassin
— Start SpamAssassinsystemctl stop spamassassin
— Stop SpamAssassinsystemctl restart spamassassin
— Restart SpamAssassinsystemctl status spamassassin
— Check service status
⬆️ Update and Check
sa-update
— Update SpamAssassin rulesspamassassin -t < email.eml
— Test an email for spamspamc < email.eml
— Quick spam test using client
🔍 Diagnostics and Configuration
spamassassin --lint
— Check configuration for errorsspamassassin --dump-headers
— Output all headers used for filteringspamassassin --version
— Show SpamAssassin version
🔧 System
systemctl start opendkim
— Start OpenDKIMsystemctl stop opendkim
— Stop OpenDKIMsystemctl restart opendkim
— Restart OpenDKIMsystemctl status opendkim
— Check service status
⚙️ Configuration
nano /etc/opendkim.conf
— Main configuration filenano /etc/opendkim/KeyTable
— Key tablenano /etc/opendkim/SigningTable
— Signing table (domains to sign)nano /etc/opendkim/TrustedHosts
— Trusted hosts
🛠️ Key Generation
opendkim-genkey -s mail -d example.com
— Generate DKIM keycat mail.txt
— View DKIM DNS record
🕵️♂️ Diagnostics
journalctl -u opendkim -f
— View logs in real timeopendkim-testkey -d example.com -s mail -vvv
— Test DKIM key
📦 Installation
apt install apache2
— Install on Debian/Ubuntudnf install httpd
— Install on AlmaLinux/CentOS/RHEL
🔧 Service Management
systemctl start apache2
— Start Apache (Debian)systemctl start httpd
— Start Apache (AlmaLinux)systemctl restart apache2
— Restart (Debian)systemctl restart httpd
— Restart (AlmaLinux)systemctl status apache2
— Status (Debian)systemctl status httpd
— Status (AlmaLinux)
🛠️ Configuration
/etc/apache2/apache2.conf
— Main config (Debian)/etc/httpd/conf/httpd.conf
— Main config (AlmaLinux)/etc/apache2/sites-available
— Virtual hosts (Debian)/etc/httpd/conf.d
— Virtual hosts (AlmaLinux)
🚀 Site Management Commands (Debian only)
a2ensite site.conf
— Enable a sitea2dissite site.conf
— Disable a sitea2enmod rewrite
— Enable a modulea2dismod rewrite
— Disable a module
🧪 Testing and Restart
apachectl configtest
— Test configurationapachectl graceful
— Graceful restartjournalctl -u apache2 -f
— Real-time logs (Debian)journalctl -u httpd -f
— Real-time logs (AlmaLinux)