Consider: : disaster-area; notmuch search --output=files id:87hbph5yww.fsf@aw.hh.sledj.net /home/dme/Maildir/mail/list/notmuch/xx01550 : disaster-area; notmuch search --duplicate=2 --output=files id:87hbph5yww.fsf@aw.hh.sledj.net : disaster-area; notmuch search --duplicate=2 --output=messages id:87hbph5yww.fsf@aw.hh.sledj.net id:87hbph5yww.fsf@aw.hh.sledj.net : disaster-area; There's only one file, but the last search which asks for results where there are more than one reports the message id.