DOVEADM-PURGE(1)

πŸ’… DOVEADM-PURGE(1) β€” the doveadm purge glow-up

okay bestie, gather round, because this is the Dovecot manual page for doveadm-purge, and it's genuinely so useful. sit down, hydrate, and let's get into it 🫢


✨ NAME ✨

doveadm-purge β€” remove messages with refcount=0 from mdbox files


✨ SYNOPSIS ✨

doveadm [GLOBAL OPTIONS] purge [-S socket_path] -A

doveadm [GLOBAL OPTIONS] purge [-S socket_path] -F file

doveadm [GLOBAL OPTIONS] purge [-S socket_path] --no-userdb-lookup

doveadm [GLOBAL OPTIONS] purge [-S socket_path] -u user

✨ DESCRIPTION ✨

so the doveadm purge command is literally here to remove all messages with refcount=0 from a user's mail storage. and when does a message hit refcount=0, you ask? it happens when the user β€” or some administration utility β€” has expunged every single instance of that message from all mailboxes. at that point the refcount drops to 0, and it's giving "this message has no more friends, it can go". πŸ¦‹

and now, the four forms, one by one:

  • in the first form, the command will be executed for all users. everybody. the whole squad.
  • in the second form, the command will be executed for all users listed in the given file.
  • in the third form, the command will be performed for the user contained in the USER environment variable.
  • in the last form, only messages of the given user(s) will be purged. selective. main character energy. πŸ’…

✨ GLOBAL OPTIONS ✨

these are the global doveadm(1) options, bestie β€” they apply across the board:

  • -D β€” enables verbosity and debug messages. it's giving loud and proud. πŸ”₯
  • -O β€” do not read any config file, just use defaults. the dovecot_storage_version setting defaults to the latest version, but it can be overridden with -o. (yes, that's a lot of defaults, be brave)
  • -k β€” preserve the entire environment for doveadm, not just the import_environment setting. lowkey important.
  • -v β€” enables verbosity, including a progress counter. so satisfying to watch ngl πŸ“ˆ
  • -i instance-name β€” if you're using multiple Dovecot instances, choose the config file based on this instance name. see the instance_name setting for more information.
  • -c config-file β€” read configuration from the given config-file. by default it first reads config socket, and then falls back to /etc/dovecot/dovecot.conf. you can also point this to the config socket of some instance running a compatible version. iconique.
  • -o setting=value β€” overrides the configuration setting from /etc/dovecot/dovecot.conf and from the userdb with the given value. in order to override multiple settings, the -o option may be specified multiple times. stack 'em. πŸ’…

✨ OPTIONS ✨

  • -A β€” if the -A option is present, the command will be performed for all users.
okay so real talk: using this option in combination with system users from userdb { driver = passwd } is not recommended, because it contains also users with a lower UID than the one configured with the first_valid_uid setting. 😭 not the low-UID jump scare.

when the SQL userdb module is used, make sure that the userdb_sql_iterate_query setting setting matches your database layout. (yes, the original says "setting setting", and we respect the original, periodt.)

when using the LDAP userdb module, make sure that the userdb_fields setting and userdb_ldap_iterate_fields setting settings match your LDAP schema. otherwise doveadm(1) will be unable to iterate over all users. πŸ’€

  • -F file β€” execute the command for all the users in the file. this is similar to the -A option, but instead of getting the list of users from the userdb, they are read from the given file. the file contains one username per line. one. per. line. πŸ“
  • --no-userdb-lookup β€” do not perform userdb lookup. use the USER environment variable to specify the username.
  • -S socket_path β€” the option's argument is either an absolute path to a local UNIX domain socket, or a hostname and port (hostname:port), in order to connect a remote host via a TCP socket.

this allows an administrator to execute doveadm(1) mail commands through the given socket. remote girlies, this one's for you 🌈

  • -u user/mask β€” run the command only for the given user. it's also possible to use '*' and '?' wildcards (e.g. -u *@example.org). wildcard slay. ✨

✨ REPORTING BUGS ✨

found a bug? 😭 report bugs, including doveconf -n output, to the Dovecot Mailing List ⟨dovecot@dovecot.org⟩. information about reporting bugs is available at: ⟨https://dovecot.org/bugreport.html⟩. include the doveconf -n output fr fr, they need it.


✨ SEE ALSO ✨

additional resources:

  • dbox

and that's the whole page bestie, no cap, you ate it πŸ’–

this was DOVEADM-PURGE(1) from Dovecot, source version f979264, dated April 2026. periodt. πŸ‘‘

πŸ“¦ where this page comes from