Linux command
drush 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Clear all caches
drush cache:rebuild
Enable and install
drush pm:install [module_name]
Update database
drush updatedb
Run cron
drush cron
Show site status
drush status
Export configuration
drush config:export
Import configuration
drush config:import
Generate one-time
drush user:login
Dump the database
drush sql:dump --result-file=[dump.sql]
Open an interactive SQL
drush sql:cli
说明
Drush (Drupal Shell) is the command-line interface for Drupal, providing tools for site administration, development, and deployment. It's essential for Drupal developers and administrators. The tool handles cache clearing, module management, database updates, configuration synchronization, and user administration. Short aliases (cr, cex, cim) provide quick access to common commands. Drush supports site aliases for managing multiple Drupal sites and integrates with deployment workflows for configuration management.
参数
- cache:rebuild, cr
- Clear all caches.
- pm:install _NAME_, en
- Enable and install a module.
- pm:uninstall _NAME_, pmu
- Uninstall a module.
- updatedb, updb
- Apply database updates.
- config:export, cex
- Export configuration.
- config:import, cim
- Import configuration.
- user:login, uli
- Generate login link.
- sql:dump
- Export database to a SQL file.
- sql:cli, sqlc
- Open an interactive SQL shell using Drupal credentials.
- status, st
- Show site information.
- --yes, -y
- Auto-accept confirmations.
- --uri _URI_
- Drupal URI for multi-site setups.
- --help
- Display help information.
FAQ
What is the drush command used for?
Drush (Drupal Shell) is the command-line interface for Drupal, providing tools for site administration, development, and deployment. It's essential for Drupal developers and administrators. The tool handles cache clearing, module management, database updates, configuration synchronization, and user administration. Short aliases (cr, cex, cim) provide quick access to common commands. Drush supports site aliases for managing multiple Drupal sites and integrates with deployment workflows for configuration management.
How do I run a basic drush example?
Run `drush cache:rebuild` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does cache:rebuild, cr do in drush?
Clear all caches.