When doing drush pm-list I get a whole list of modules but too much info also, like this:

Mail Privatemsg filter (privatemsg_filter) 7.x-1.4
Mail Privatemsg Limits (privatemsg_limits) 7.x-1.4
Mail Privatemsg roles (privatemsg_roles) 7.x-1.4`

I have to edit in notepad++ and run macros...

I want the module list, but ONLY drush module names X_Y

Is there a way to get a clean list like:



And then can use it as:

drush en module_a module_b module_c
drush pm-list --status="enabled" --pipe
  • --status="enabled" Filter by extension status. Choices: enabled, disabled and/or 'not installed'. You can use multiple comma separated values. (i.e. --status="disabled,not installed").

  • --pipe Equivalent to --format=list.

  • --format="list" Select output format. Available: table, csv, json, list, var_export, yaml. Default is table.

| improve this answer | |
  • Interesting! Though I'm a very little bit confused: if you would change --pipe to --format="list" , would you then get the very same result? – Pierre.Vriens Aug 19 '16 at 10:28
  • Yes. You get the same result. – Елин Й. Aug 20 '16 at 8:58
  • Merci for confirming ! – Pierre.Vriens Aug 20 '16 at 19:59

Ok, got it working, commands to use are:

drush pm-list --type=module --status=enabled --no-core --format=list

and then you can use the:


from drush console.

| improve this answer | |

If the purpose of your question is to repopulate a new site (as in your question title), then you may want to look at the drush make-generate command.

No need for things like editing and/or running macros (though you could edit the result if for whatever reason you still have to do so).

Refer to How to use Drush Make in your daily routine for an interesting article about it also.

| improve this answer | |
  • I tried this command: drush pm-list type=module status=enabled --no-core --format=list it works, but only ALL contrib modules, the "status=enabled" command gets ignored, am I doing something wrong? – Bruno Vincent Sep 15 '15 at 10:24

You can obtain the list using the module_list() function

Returns a list of currently active modules.

Usually, this returns a list of all enabled modules. When called early on in the bootstrap, it will return a list of vital modules only (those needed to generate cached pages).

All parameters to this function are optional and should generally not be changed from their defaults. Parameters

$refresh: (optional) Whether to force the module list to be regenerated (such as after the administrator has changed the system settings). Defaults to FALSE.

$bootstrap_refresh: (optional) When $refresh is TRUE, setting $bootstrap_refresh to TRUE forces the module list to be regenerated using the reduced set of modules loaded in "bootstrap mode" for cached pages. Otherwise, setting $refresh to TRUE generates the complete list of enabled modules.

$sort: (optional) By default, modules are ordered by weight and module name. Set this option to TRUE to return a module list ordered only by module name.

$fixed_list: (optional) If an array of module names is provided, this will override the module list with the given set of modules. This will persist until the next call with $refresh set to TRUE or with a new $fixed_list passed in. This parameter is primarily intended for internal use (e.g., in install.php and update.php).

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.