Blog Social
Content Management

10 Essential Drush Commands for Mastering Your Drupal Workflow

September 12, 2025 4 minute read
Boost your productivity with 10 essential Drush commands for any Drupal workflow. Learn shortcuts for caching, config management, security, and more.
Blog Social

If you're working with Drupal, using Drush (the Drupal Shell) is a game-changer. It's a command-line tool that lets you manage your site with lightning speed, turning complex tasks that take multiple clicks into simple, one-line commands. ⚡

While Drush has hundreds of commands, you only need a handful to handle most of your daily tasks. Here are 10 fundamental commands that will dramatically boost your productivity.

cache:rebuild (cr)

This is the command you'll use most often. It completely clears and rebuilds all of Drupal's caches. Whenever you make a change in code, configuration, or themes and don't see it reflected on the site, your first instinct should be to run this.

# Rebuild all caches
drush cache:rebuild
# Or use the popular alias
drush cr

updatedb (updb) &updatedb:status (updbst)

When you update a module, it might include database schema changes. The updatedb command applies these pending updates safely. Before running it, it's always a good idea to check what updates are pending.

# Check for any pending database updates
drush updatedb:status
# Apply all pending updates
drush updb -y

The -y flag automatically answers "yes" to the confirmation prompt, which is great for scripting.


pm:list (pml)

Need to quickly see which modules or themes are enabled on your site? This command lists all extensions and their status. It's incredibly useful for getting a quick overview or for finding a specific module.

# Show all modules and themes
drush pm:list
# Use grep to find a specific module
drush pml | grep "views"

config:pull (cpull)

Managing configuration between different environments (like development, staging, and production) is crucial. This command exports the configuration from a source environment (defined in your drush.yml file) and imports it into your current site, synchronizing your settings. It's a key part of a standard configuration workflow.

# Pull configuration from a source alias (e.g., @live)
drush config:pull @live

watchdog:show (ws)

When something goes wrong, the Drupal log is your best friend. This command shows you the most recent log messages directly in your terminal, helping you debug errors without needing to navigate through the admin UI.

# Show the last 10 log messages
drush watchdog:show
# Show more messages and tailor the output
drush ws --count=50 --type=php

Security Checks: pm:security & pm:security-php

Keeping your site secure is non-negotiable. These two commands scan your project for known security vulnerabilities—one for Drupal modules and the other for underlying PHP packages. Run them regularly to stay ahead of potential threats. 🛡️

# Check Drupal packages for security updates
drush pm:security
# Check non-Drupal PHP dependencies
drush pm:security-php

entity:updates (entup)

Sometimes, changes to your custom code require updates to entity definitions (like adding a new field to a content type programmatically). This command applies those pending entity schema updates, similar to updb but for the Entity API.

# Apply pending entity updates
drush entity:updates

sql:cli (sqlc)

Need to run a direct SQL query? This command is your gateway. It opens a SQL command-line interface and automatically logs you in using the site's database credentials, saving you the hassle of looking them up.

# Open a SQL command-line prompt
drush sql:cli

Once inside, you can run any SQL query you need, like SHOW TABLES; or SELECT * FROM users;.


config:export (cex)

This is the counterpart to importing configuration. When you make changes to your site's configuration in the UI (like creating a new view or changing site settings), you need a way to save them to code so they can be version-controlled and deployed elsewhere. config:export writes these settings to YAML files in your config sync directory.

# Export the current site configuration to files
drush config:export
# Or use the alias
drush cex

Workflow Tip: Typically, you'll make changes, run drush cex, commit the changes to Git, and then another developer or a deployment script will run drush config:import on another environment.


user:login (uli)

Have you ever needed to log in as a specific user for testing but don't know (or want to reset) their password? This command is a lifesaver. It generates a secure, one-time login link for any user account, including the administrator (user ID 1).

# Generate a login link for the main administrator (uid 1)
drush user:login
# Get a link for a user with the username "editor"
drush uli editor

Simply copy and paste the generated URL into your browser, and you'll be logged in instantly. It's incredibly fast and secure.