This article explains how to connect to your HOSTDOG hosting via SSH and run Drush commands to manage your Drupal site. It covers the most common operations — clearing cache, running database updates, importing and exporting configuration, managing modules, and creating database backups — plus a complete reference table of useful Drush commands. [VERIFY: Confirm Drush version available on shared hosting — likely Drush 12 or 13 for Drupal 10/11]
Connecting via SSH
Drush is available via SSH on all HOSTDOG hosting plans. To use it, you need to connect to your hosting account via SSH. If you haven't done this before, see how to connect via SSH.
Once connected, navigate to your Drupal root directory (the directory containing index.php or web/index.php):
cd ~/public_html
Confirm Drush is available and check the version:
drush --version
vendor/bin/drush. In this case, use vendor/bin/drush instead of just drush, or add vendor/bin to your PATH.
Essential Drush commands
The commands below cover the operations you'll use most frequently when maintaining a Drupal site.
The most-used Drush command. Run this after any configuration change, module update, or code deployment:
drush cr
cr is the alias for cache:rebuild. It rebuilds the Drupal service container and clears all caches — equivalent to visiting Administration → Performance → Clear all caches.
After updating modules or Drupal core, run database updates to apply any schema changes:
drush updb -y
The -y flag automatically confirms all update operations. Without it, Drush will prompt you to confirm each update. Always run drush cr after drush updb.
Drupal 8+ uses a configuration management system. Export your site's configuration to YAML files (for deployment or version control):
drush cex -y
Import configuration from YAML files (e.g., after pulling changes from version control):
drush cim -y
drush cim will overwrite your active configuration with the files in your config/sync directory. Always review changes before importing on a production site.
Enable a module (after installing it via Composer):
drush en module_name -y
Uninstall a module:
drush pmu module_name -y
List all installed modules with their status:
drush pm:list --status=enabled
Export your Drupal database to a file — use before updates, migrations, or any major change:
drush sql-dump --result-file=~/drupal-backup-$(date +%Y%m%d).sql
With compression:
drush sql-dump --gzip --result-file=~/drupal-backup-$(date +%Y%m%d).sql.gz
See how to create and restore Drupal backups for the full backup and restore workflow.
Drush command reference
| Command | Alias | What it does |
|---|---|---|
drush cache:rebuild |
drush cr |
Rebuild service container and clear all caches |
drush updatedb |
drush updb |
Run pending database updates after module/core update |
drush config:export |
drush cex |
Export active configuration to YAML files |
drush config:import |
drush cim |
Import configuration from YAML files into active database |
drush pm:enable module |
drush en module |
Enable a module |
drush pm:uninstall module |
drush pmu module |
Uninstall a module |
drush pm:list |
drush pml |
List all modules with status, version, and type |
drush sql:dump |
drush sql-dump |
Export the database to a SQL file |
drush sql:cli |
drush sql-cli |
Open a MySQL shell for the Drupal database |
drush core:status |
drush status |
Show Drupal version, paths, and database connection info |
drush watchdog:show |
drush ws |
Show recent Drupal log messages |
drush user:login |
drush uli |
Generate a one-time admin login link |
drush deploy |
— | Run deploy sequence: updatedb, cim, cr (Drupal 9.1+) |
Troubleshooting
If Drush is installed as a Composer dependency, it lives at vendor/bin/drush inside your project directory. Try running ./vendor/bin/drush --version from your Drupal root. You can also add vendor/bin to your PATH in ~/.bashrc to use drush directly: export PATH="$HOME/public_html/vendor/bin:$PATH"
Drush must be run from inside a Drupal directory. Check your current directory with pwd and navigate to your Drupal root with cd ~/public_html. If your Drupal is in a subdirectory (e.g., web/), run Drush from the project root that contains composer.json, not from inside web/.
This usually means Drupal cannot connect to the database. Check that the database credentials in sites/default/settings.php are correct and that the database service is running. You can test the database connection with drush status, which shows the database status directly.