Get Free Linux Server Security, Performance & Troubleshooting Tips

How to Delete mailman archives on cPanel using the Linux terminal

How to Delete mailman archives on cPanel using the Linux terminal
4.8 (96.67%) 6 votes

Mailman archiving can be turned off from your mailing list administration area, at option Archive. However… let’s suppose you have a mailman mailing list called list@yoursite.com and you need to clean that list from the command line. The question is: how can I delete mailman archives from the terminal on cPanel?

Step by step delete mailman archives on cPanel from command line

cd /usr/local/cpanel/3rdparty/mailman/archives/private

You will see lot of directories inside that location.

Each directory is usually associated with a mailman email list, for example:




list@yoursite.com will have this directory assigned: list_yoursite.com

Active lists in a single cpanel server:

drwxr-x---  2 mailman nobody  4.0K Feb 10  2014 mailman/
drwxrwx---  2 mailman mailman 4.0K Feb 10  2014 mailman.mbox/
drwxr-x---  2 mailman nobody  4.0K Nov 18 23:47 mail_mailing.com/
drwxrwx---  2 mailman mailman 4.0K Nov 18 23:47 mail_mailing.com.mbox/
drwxr-x---  2 mailman nobody  4.0K Nov 18 23:47 list_yoursite.com/
drwxrwx---  2 mailman mailman 4.0K Nov 18 23:47 list_yoursite.mbox/

Now that you located your directory list, move inside that location.

cd list_yoursite.com

List the content with ls command




ls -alh

This is the output on one of my servers:

drwxr-xr-x  2 mailman mailman 4.0K Sep 13  2016 2016-September/
-rw-r--r--  1 mailman mailman 1.4K Sep 13  2016 2016-September.txt
-rw-r--r--  1 mailman mailman  680 Sep 14  2016 2016-September.txt.gz
drwxr-xr-x  3 mailman mailman 4.0K Sep 13  2016 attachments/
drwxr-x---  2 mailman mailman 4.0K Sep 13  2016 database/
-rw-r--r--  1 mailman mailman 1.2K Sep 13  2016 index.html
-rw-r--r--  1 mailman mailman  925 Sep 13  2016 pipermail.pck

Now remove all the 2016-September.* in this case:

rm 2016* -rf

You can also remove the database and attachments if you want, as they also store old data from your mailman lists:

[root@server.nixcp.com:~]ls -alh database/
total 28K
drwxr-x--- 2 mailman mailman 4.0K Sep 13 2016 ./
drwxr-x--- 5 mailman nobody 4.0K Sep 14 2016 ../
-rw-r--r-- 1 mailman mailman 2.1K Sep 13 2016 2016-September-article
-rw-r--r-- 1 mailman mailman 344 Sep 13 2016 2016-September-author
-rw-r--r-- 1 mailman mailman 285 Sep 13 2016 2016-September-date
-rw-r--r-- 1 mailman mailman 311 Sep 13 2016 2016-September-subject
-rw-r--r-- 1 mailman mailman 288 Sep 13 2016 2016-September-thread
[root@server.nixcp.com:~]ls -alh attachments/
total 12K
drwxr-xr-x 3 mailman mailman 4.0K Sep 13 2016 ./
drwxr-x--- 5 mailman nobody 4.0K Sep 14 2016 ../
drwxr-xr-x 3 mailman mailman 4.0K Sep 13 2016 20160913/
[root@server.nixcp.com:~]

That’s all, now you know how to delete mailman archives on cpanel / whm servers.

To reflect the disk space usage in cPanel and to clean the cache for mailman run below command:

/scripts/update_mailman_cache

Further reading:

Leave a Reply

Your email address will not be published. Required fields are marked *