Manual:RemoveUnusedAccounts.php

Details
removeUnusedAccounts.php is a maintenance>Special:MyLanguage/Manual:Maintenance scripts|maintenance script. An unused account is one which has no edits, no deleted edits, no log entries (), and no current/old uploads.

You can use  to first remove deleted revisions (e.g. vandalism>Special:MyLanguage/Manual:Combating vandalism#Cleaning up|after a massive vandalism/spam attack) and run removeUnusedAccounts.php afterwards.

Usage
It will only list the unused accounts, without deleting the accounts. If you want to actually delete the unused account, use this command with --delete.