Generating content with Devel and Drush cheatsheet

When you build Drupal sites, you may need to populate it with dummy content. You can use a module called Devel Generate, which comes packaged with Devel to do this and it comes with handy Drush commands.

Generate Nodes

Create 20 nodes and no comments:

drush genc 20

Create 20 nodes and 10 comments:

drush genc 20 10

Delete and generate new nodes:

drush genc 2 10 --kill

Specify the content type

drush genc 20 --types=latest_news

Generate 20 Latest News nodes with a maximum 10 comments and delete existing content

drush genc 20 10 --kill --types=latest_news

Delete nodes

Delete all nodes for the latest_news content type:

drush genc 0 --types=latest_news