Skip to main content

Bulk deleting entities with drush

With drush 10 you can easily bulk delete any entity with their bundles. Here are some examples:

Delete all terms from taxonomy vocabulary tags:

drush entity:delete taxonomy_term --bundle=tags  

Delete all articles nodes:

drush entity:delete node --bundle=article

Other examples from drush.org website:


    drush entity:delete node --bundle=article. #Delete all article entities.
    drush entity:delete shortcut. #Delete all shortcut entities.
    drush entity:delete node 22,24. #Delete nodes 22 and 24.
    drush entity:delete node --exclude=9,14,81. #Delete all nodes except node 9, 14 and 81.
    drush entity:delete user. #Delete all users except uid=1.
    drush entity:delete node --chunks=5. #Delete all node entities in steps of 5.

For extra arguments and options, more here: https://www.drush.org/11.x/commands/entity_delete/

drush