LinuxCommandLibrary

drupal

Manage Drupal websites from the command line

TLDR

Install a module

$ drupal module:install [module_name]
copy

Uninstall a module
$ drupal module:uninstall [module_name]
copy

Clear all caches
$ drupal cache:rebuild
copy

View current Drupal installation status
$ drupal site:status
copy

SYNOPSIS

drupal [options] <command> [<arguments>...]

PARAMETERS

--root[=ROOT]
    Specify Drupal root directory

--uri[=URI]
    Site URI (default: http://default)

--site-dir[=DIR]
    Site directory name

--env[=ENV]
    Environment (dev, prod, etc.)

--no-interaction
    Non-interactive mode; no prompts

--debug
    Display debug info

-v|-vv|-vvv, --verbose
    Increase verbosity level

-q, --quiet
    No output except errors

--ansi
    Force ANSI colored output

--no-ansi
    Disable ANSI colors

-h, --help
    Show command help

--version
    Show version info

--profile
    Execution profile name

DESCRIPTION

The drupal command provides a powerful command-line interface for Drupal developers, part of the Drupal Console toolset.

It enables rapid generation of boilerplate code such as modules, plugins, controllers, forms, services, and routes using intuitive generators like generate:module or generate:form.

Site administration tasks include cache clearing (cache:rebuild), configuration import/export (config:import, config:export), database updates (update:entities), and debugging tools like debug:container or router:debug.

Built on Symfony Console components, it offers autocomplete, colored output, and progress bars for a modern UX. Supports multiple Drupal sites via --root and --uri options.

Ideal for Drupal 8/9 workflows, though deprecated; many features overlap with Drush.

CAVEATS

Drupal Console deprecated since 2021; prefer Drush 11+ for production. Launcher supports multi-version but compatibility limited to Drupal 8/9.

INSTALLATION

Via Composer: composer global require drupal/console:~1.9 --prefer-dist
Add ~/.console/chain or ~/.drupal/console/bin/drupal to PATH

COMMON COMMANDS

drupal list (show commands)
drupal generate:module (create module)
drupal cache:rebuild (clear caches)

AUTOCOMPLETE

Enable shell autocomplete: drupal autocomplete:init --shell=bash

HISTORY

Launched in 2015 by Javier Antonio PenĂ£ as Symfony-based alternative to Drush for Drupal 8. Gained popularity for code generation. Version 1.0 stable in 2016, peaked at 1.9.x. Deprecated post-Drupal 9 (2021); features integrated into Drush or phased out.

SEE ALSO

drush(1), composer(1), php(1), symfony(1)

Copied to clipboard