Skip to content

Instantly share code, notes, and snippets.

@syammohanmp
Last active December 11, 2023 09:00
Show Gist options
  • Save syammohanmp/ee376293dbce0870a888755dcc16ffec to your computer and use it in GitHub Desktop.
Save syammohanmp/ee376293dbce0870a888755dcc16ffec to your computer and use it in GitHub Desktop.
Useful commands for Drupal

Useful commands for Drupal

Generate SSH Key

$ ssh-keygen -t ed25519 -C "abc@bcd.com"

Note: If you are using a legacy system that doesn't support the Ed25519 algorithm, use:

$ ssh-keygen -t rsa -b 4096 -C "abc@bcd.com"

Password change

drush upwd admin --password="admin"

drush upwd "admin" --password=admin

Using drush 9 do the following:

drush upwd my_username my_password

drush upwd admin 123456

Drop all tables in a given database.

drush sql-drop

Export DB Drupal 8 and 9

drush cr

drush sql-dump > ~/my-sql-dump-file-name.sql

Import database

You can use this command to import the sql dump into your Drupal database.

drush sql-drop

drush sql-cli < ~/my-sql-dump-file-name.sql

Drupal standard

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml <PATH>

phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml <PATH>

Remove module from core.extension

drush cdel core.extension module.<module-name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment