Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Drupal 8 Console Commands

Parent Feed: 

With the release of Drupal 8 comes the new CLI to generate boilerplate code, interact and debug Drupal (for earlier versions of Drupal, see drush-related coder module tools). The transition from drush to drupal can be a little bit frustrating learning the new commands. To help ease the stress, I’ve put together a list of the most common Drupal 8 Console commands.

Drupal 8 Console Commands

Drupal 8 Console has been designed to facilitate the Drupal 8 adoption while making development and interaction more efficient and enjoyable. Use the cheat sheet below will help you hit the ground running with Drupal Console.

Drupal 8 Console: Cache Commands

# Rebuild and clear all site caches.
$ drupal cache:rebuild

# Rebuilds all caches
$ drupal cr all

# Rebuild discovery cache
$ drupal cr discovery

Drupal 8 Console: Module Commands

# Display current modules available for application
$ drupal module:debug

# Download module or modules in application
$ drupal module:download

# Install module or modules in the application
$ drupal module:install

# Uninstall module or modules in the application
$ drupal module:uninstall

Drupal 8 Console: Image Commands

# List image styles on the site
$ drupal image:styles:debug

# Execute flush function by image style or execute all flush images styles
$ drupal image:styles:flush

Drupal 8 Console: User Commands

# Displays current users for the application
$ drupal user:debug

# Delete users for the application
$ drupal user:delete

# Clear failed login attempts for an account.
$ drupal user:login:clear:attempts

# Returns a one-time user login url.
$ drupal user:login:url

# Generate a hash from a plaintext password.
$ drupal user:password:hash

# Reset password for a specific user.
$ drupal user:password:reset

Drupal 8 Console: Generate Commands

# Generate an Authentication Provider
$ drupal generate:authentication:provider

# Generate commands for the console.
$ drupal generate:command

# Generate & Register a controller
$ drupal generate:controller

# Generate the DrupalConsole.docset package for Dash
$ drupal generate:doc:dash

# commands.generate.doc.data.description
$ drupal generate:doc:data

# Generate documentations for Commands
$ drupal generate:doc:gitbook

# Generate a new content type (node / entity bundle)
$ drupal generate:entity:bundle

# Generate a new config entity
$ drupal generate:entity:config

# Generate a new content entity
$ drupal generate:entity:content

# Generate an event subscriber
$ drupal generate:event:subscriber

# Generate a new "FormBase"
$ drupal generate:form

# Generate an implementation of hook_form_alter() or hook_form_FORM_ID_alter
$ drupal generate:form:alter

# Generate a new "ConfigFormBase"
$ drupal generate:form:config

# Generate a module.
$ drupal generate:module

# Generate module permissions
$ drupal generate:permissions

# Generate a plugin block
$ drupal generate:plugin:block

# Generate CKEditor button plugin.
$ drupal generate:plugin:ckeditorbutton

# Generate a plugin condition.
$ drupal generate:plugin:condition

# Generate field type, widget and formatter plugins.
$ drupal generate:plugin:field

# Generate field formatter plugin.
$ drupal generate:plugin:fieldformatter

# Generate field type plugin.
$ drupal generate:plugin:fieldtype

# Generate field widget plugin.
$ drupal generate:plugin:fieldwidget

# Generate image effect plugin.
$ drupal generate:plugin:imageeffect

# Generate image formatter plugin.
$ drupal generate:plugin:imageformatter

# Generate a plugin mail
$ drupal generate:plugin:mail

# Generate plugin rest resource
$ drupal generate:plugin:rest:resource

# Generate a plugin rule action
$ drupal generate:plugin:rulesaction

# Generate a plugin type with annotation discovery
$ drupal generate:plugin:type:annotation

# Generate a plugin type with Yaml discovery
$ drupal generate:plugin:type:yaml

# Generate a custom plugin view field.
$ drupal generate:plugin:views:field

# Generate a profile.
$ drupal generate:profile

# Generate a RouteSubscriber
$ drupal generate:routesubscriber

# Generate service
$ drupal generate:service

# Generate a theme.
$ drupal generate:theme

Drupal 8 Console: Cron Commands

# List of modules implementing a cron
$ drupal cron:debug

# Execute cron implementations by module or execute all crons
$ drupal cron:execute

# Release cron system lock to run cron again
$ drupal cron:release

Drupal 8 Console: Theme Commands

# Displays current themes for the application
$ drupal theme:debug

# Download theme in application
$ drupal theme:download

# Install theme or themes in the application
$ drupal theme:install

# Uninstall theme or themes in the application
$ drupal theme:uninstall

Drupal 8 Console: Views Commands

# Display current views resources for the application
$ drupal views:debug

# Disable a View
$ drupal views:disable

# Enable a View
$ drupal views:enable

# Display current views plugins for the application
$ drupal views:plugins:debug

Drupal 8 Console: Translation Commands

# Clean up translation files
$ drupal translation:cleanup

# Determine pending translation string in a language or a specific file in a language
$ drupal translation:pending

# Generate translate stats
$ drupal translation:stats

# Sync translation files
$ drupal translation:sync

Drupal 8 Console: Site Commands

# List all known local and remote sites.
$ drupal site:debug

# Import/Configure an existing local Drupal project
$ drupal site:import:local

# Install a Drupal project
$ drupal site:install

# Switch site into maintenance mode
$ drupal site:maintenance

# Switch system performance configuration
$ drupal site:mode

# Create a new Drupal project
$ drupal site:new

# Show the current statistics of website.
$ drupal site:statistics

# View current Drupal Installation status
$ drupal site:status

Drupal 8 Console: Database Commands

# Launch a DB client if it's available
$ drupal database:client

# Shows DB connection
$ drupal database:connect

# Drop all tables in a given database.
$ drupal database:drop

# Dump structure and contents of a database
$ drupal database:dump

# Remove events from DBLog table, filters are available
$ drupal database:log:clear

# Display current log events for the application
$ drupal database:log:debug

# Restore structure and contents of a database.
$ drupal database:restore

# Show all tables in a given database.
$ drupal database:table:debug

Drupal 8 Console: Create Commands

# Create dummy comments for your Drupal 8 application.
$ drupal create:comments

# Create dummy nodes for your Drupal 8 application.
$ drupal create:nodes

# Create dummy terms for your Drupal 8 application.
$ drupal create:terms

# Create dummy users for your Drupal 8 application.
$ drupal create:users

# Create dummy vocabularies for your Drupal 8 application.
$ drupal create:vocabularies

Drupal 8 Console: Miscellaneous Commands

# Display basic information about Drupal Console project
$ drupal about

# Chain command execution
$ drupal chain

# System requirement checker
$ drupal check

# Displays help for a command
$ drupal help

# Copy configuration files to user home directory.
$ drupal init

# Lists all available commands
$ drupal list

# Update project to the latest version.
$ drupal self-update

# Runs PHP built-in web server
$ drupal server
RSS Tags: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web