10 Drush Commands for Drupal CMS

  • 2 minute read

Drush - The "drush" command is very useful for accessing and manipulating your website's settings and data from the command line.

If you are new to Drush, you might find the large number of commands available overwhelming and not know which ones to start with.

1. watchdog-show (ws)- Show a listing of most recent 10 log messages.

drush watchdog-show

2. pm-list (pml)- Show a list of available extensions (modules and themes )

drush pm-list

drush pm-list | grep modulename

3. pm:security (sec)-  Check Drupal Composer packages for pending security updates.

drush pm:security --format=json

4. pm:security-php (sec-php)-  Check non-Drupal PHP packages for pending security updates.

drush pm:security-php --format=json

5. updatedb:status (updbst)-  Checks list of any pending database updates.

drush updatedb:status
drush updbst

6. updatedb (updb)- To run any pending database updates required.

drush updb

7. config:pull (cpull)- Export and Transfer config from one environment to other environment.

drush config:pull

8. cache:clear (cc)- Clear a specific or all Drupal  cache.

drush cache:clear
drush cc

cache:rebuild (cr)- Rebuild all caches, This is a copy of core/rebuild.php.

drush cache:rebuild
drush cr

9. entity:updates (entup)- All pending entity schema update.

drush entity:updates

10. sql:cli (sqlc)- Open a SQL command-line interface using Drupal's credentials.

drush sql:cli