Filters
Content Type
Topics
Drush Commands to Optimize Your Drupal Workflow
If you’re a Drupal developer, you already know that efficiency is everything. Whether deploying new features, troubleshooting performance issues or just managing content updates, every second saved counts. That’s why Drush (Drupal Shell) is an incredibly important tool.
Drush streamlines your entire Drupal workflow by giving you command-line control over your site. Forget the sluggish point-and-click approach of the admin UI. Instead, with just a few keystrokes, Drush empowers you to quickly clear caches, manage modules, update databases and even log in as different users.
So, without further ado, let’s get into it! We’ll explore some of the most essential Drush commands every Drupal developer should know.
Benefits of using Drush commands
By replacing tedious, repetitive tasks with simple command-line instructions, Drush helps you move faster, work smarter and reduce the risk of human error – here’s how:
- Speed and efficiency: Clicking through the Drupal admin UI to clear caches, enable modules or update configurations is time-consuming. With Drush, these tasks are reduced to a single command, saving you minutes (or even hours) over the course of a project.
- Automation and scripting: Why repeat the same commands manually when you can automate them? Drush allows you to script repetitive tasks – like syncing databases between environments – so your workflow runs smoother with minimal input.
- Remote site management: If you need to manage multiple Drupal sites across different environments, Drush lets you execute commands remotely, making it easy to deploy changes, update modules or even troubleshoot an issue on a production site – without ever opening the Drupal UI.
- Better developer experience: Drush brings a powerful, developer-friendly interface to Drupal, enabling more advanced control over site operations. It integrates smoothly with version control workflows, CI/CD pipelines and local development environments like Lando and DDEV.
Simply put, if you’re still relying solely on the Drupal UI for site management, you’re working harder than you need to. Drush is the key to a more optimized, professional and scalable workflow.
Top 15 drush commands
1. drush help
Let’s start with the basics! Whenever you're unsure about a Drush command, use drush help followed by the command name to get detailed documentation including syntax, arguments and options.
Example:
drush help cache:rebuild
This provides information on the cache:rebuild command (which we’ll explain later in this list), including usage instructions and available flags.
2. drush cache:clear
Drupal uses caching mechanisms to improve performance, but at times, clearing caches is necessary to ensure new changes take effect. The cache:clear command allows you to clear specific cache bins selectively without affecting the entire system.
Example:
drush cache:clear render
This clears the render cache, which is responsible for caching the final HTML output of pages and blocks.
Important: drush cache:clear
lets you clear only a specific cache bin. So, if you need to clear all caches, consider using drush cache:rebuild (which we’ll explain next) instead, as it ensures a full cache refresh along with any necessary rebuilds.
3. drush cache:rebuild
cache:rebuild flushes all caches and triggers a rebuild of essential system components. This is particularly useful after deployments, configuration changes or module updates.
Example:
drush cache:rebuild
You can also use the short alias:
drush cr
This will remove all cached data and regenerate necessary caches to reflect the latest site configuration and updates.
4. drush config:export
Drupal’s configuration management system allows you to store site configuration in version-controlled YAML files. The config:export command is important for exporting all configurations, making it easy to sync changes between different environments.
Example:
drush config:export
This exports all configuration settings to the config sync directory (typically config/sync).
5. config:import
Just as config:export
saves your configurations, config:import applies configuration updates stored in the YAML files. This ensures that configuration changes made in one environment can be safely applied to another.
Example:
drush config:import
This imports and applies the latest configuration changes from the config sync directory.
6. drush config:pull
config:pull allows you to fetch configuration settings from one Drupal environment and apply them to another. This is particularly useful when syncing configurations across development, staging and production environments.
Example:
drush config:pull @remote @local
This pulls configuration from the remote environment (@remote) and applies it to the local environment (@local).
Make sure to always commit your local changes to avoid overwriting unintended modifications before running config:pull
.
7. drush core:status
The drush core:status command provides an overview of your Drupal installation, including details about PHP, database connection, Drush version and installed modules.
Example:
drush core:status
This outputs the Drupal version, PHP version, database connection details and site paths.
To retrieve specific status information, you can run:
drush core:status --field=drupal-version
This command will display only the Drupal version.
8. drush pm:install
The drush pm:install command is used to install a module or theme that is already present in your codebase. For Composer-managed Drupal sites (Drupal 8 and above), you'll typically use Composer to download new modules:
composer require drupal/devel
Then, you can install the module using Drush:
drush pm:install devel
This command installs the Devel module, making it active on your site.
9. drush pm:list
pm:list provides a complete list of installed modules and themes, showing whether they are enabled or disabled.
Example:
drush pm:list
This displays all installed modules and themes with status indicators.
Additionally, you can even filter results. For example, you can filter by package type:
drush pm:list --type=theme
10. drush updatedb
When updating Drupal core, modules or themes, some changes require database schema updates. updatedb ensures that all necessary updates are applied to keep the database in sync.
Example:
drush updatedb
This checks for pending database updates and applies them if necessary. Also, before running this command, back up your database in case a rollback is needed.
11. drush updatedb:status
The updatedb:status command helps you verify if any database schema updates are required before running updatedb.
Example:
drush updatedb:status
This outputs a list of pending database updates if any exist.
If updates are pending, you should apply them using:
drush updatedb
And, to simulate updates before applying them, use:
drush updatedb --simulate
This lets you preview the changes before applying them.
12. drush deploy
The deploy command is a convenient way to apply all post-deployment steps after pushing code changes. It typically runs a sequence of tasks like importing configuration, applying database updates, and executing any custom deployment hooks you’ve defined in hook_deploy() implementations.
Example:
drush deploy
This streamlines deployments by handling key tasks in one go, ensuring that your site is fully updated and consistent across environments after new code has been deployed.
Important: This command is especially useful on Composer-based Drupal sites, as it bundles together several common post-deployment steps such as drush config:import and drush updatedb.
13. drush user:login
If you ever lose access to your Drupal admin panel, user:login can generate a one-time login link to quickly regain access.
Usage Example:
drush user:login
This logs in the default admin user by generating a temporary URL.
Some advanced uses for this command include:
- Logging in as a specific user:
drush user:login --name=editor_user
- Generating a login link without opening a browser:
drush user:login --no-browser
This command is invaluable when resetting forgotten passwords or troubleshooting authentication issues.
14. drush watchdog:show
Drupal logs important system events, warnings and errors in its watchdog log. The watchdog:show command lets you quickly inspect these logs from the command line.
Example:
drush watchdog:show --count=10
This will display the last 10 log entries.
15. drush watchdog:tail
If you want real-time log monitoring, the watchdog:tail command follows the watchdog log, similar to Linux’s tail -f command.
Example:
drush watchdog:tail
It’s great for debugging issues as they happen.
How Pantheon enhances Drupal workflows
Pantheon takes Drupal development to the next level by providing a high-performance WebOps platform that streamlines workflows, automates repetitive tasks and optimizes collaboration – here’s how:
Easy environment management
One of Pantheon’s standout features is its structured Dev, Test, Live environments. Instead of manually copying databases, configurations or files between environments, Pantheon provides built-in tools – like Multidev and Terminus (which we’ll get into in the next section) – that integrate with Drush commands.
Image

You can quickly sync databases, pull configurations and test updates before pushing them live, all while ensuring consistency across environments. For example, using drush config:pull @pantheon.dev @pantheon.local
, you can sync configuration changes from your Pantheon Dev environment to your local machine effortlessly, ensuring your development environment is always in sync with production.
Automated scaling and performance optimization
With Pantheon, you don’t have to worry about infrastructure bottlenecks. The platform’s container-based architecture ensures your Drupal site scales automatically to handle traffic surges while built-in caching layers (Varnish, Redis and edge caching) enhance performance. Instead of managing caching manually, Drush commands like drush cache:rebuild or drush cache:clear work in tandem with Pantheon’s intelligent caching to refresh site content without unnecessary downtime.
CI/CD and version control integration
Pantheon’s Git-based workflow makes it easy to manage Drupal projects with version control. When used alongside Drush, developers can automate deployments, apply updates efficiently and even integrate with CI/CD pipelines for continuous delivery. For instance, after pushing your code changes – including updated configuration or new modules – you can run drush updatedb in each environment to apply any corresponding database updates. This ensures that any schema changes or updates defined in the codebase are properly applied to the database, keeping your environments in sync.
Enhanced security and backups
Pantheon also provides automated backups, HTTPS enforcement and security patches, ensuring your Drupal site remains secure. Drush makes it easy to interact with these features – whether you need to check your site's status with drush core:status or troubleshoot logs using drush watchdog:show.
How to execute a Drush command on Pantheon
Using terminus to run Drush commands
Terminus serves as Pantheon's command-line interface, allowing you to perform various site operations, including running Drush commands remotely. Here's how you can execute a Drush command using Terminus:
1. Install and authenticate terminus
Ensure you have Terminus installed on your local machine and authenticated with your Pantheon account. If you haven't set this up yet, refer to the Terminus installation guide for detailed instructions.
2. Execute Drush commands
With Terminus, you can run Drush commands on any of your site's environments without needing a local Drush installation. The syntax is:
terminus drush <site>.<env> -- <drush-command>
Here:
<site>
is your site's machine name.<env>
is the environment you want to target (dev, test, live or a Multidev environment).<drush-command>
is the specific Drush command you wish to execute.
For example, if you want to clear all caches on your development environment, your command will look like this:
terminus drush my-site.dev -- cache:rebuild
This command instructs Terminus to run cache:rebuild on the dev environment of my-site.
Take note of these important considerations:
- Environment specification: Always ensure you're targeting the correct environment (dev, test, live or a specific Multidev) when running commands to prevent unintended changes.
- Connection modes: For Drush commands that modify code or configurations, ensure your environment is in SFTP mode. You can set this via the Pantheon Dashboard or using Terminus:
terminus connection:set my-site.dev sftp
This sets the connection mode of the dev environment to SFTP, allowing code changes.
- Drush version compatibility: Pantheon supports multiple Drush versions. Ensure you're using a version compatible with your Drupal installation. You can specify the Drush version in your site's pantheon.yml file or manage it via Composer for site-local installations. For more details, refer to Pantheon's Drush version management guide.
Accelerate your Drupal development with Pantheon
Why waste time clicking through the Drupal UI when you can supercharge your workflow with Drush and Pantheon? Say goodbye to slow, repetitive tasks and hello to blazing-fast deployments, smooth automation and effortless site management. With Pantheon’s high-performance WebOps platform and the power of Drush commands, you’ll be working smarter – not harder.
Start using Drush on Pantheon today and experience the speed, efficiency and control your development workflow deserves!