Generate module
drupal generate:module - It will ask the module name and basic information.
Give the module a name of module (welcome) and Enter module description, path and basic information. Then drupal will create the below files under the your custom module.
composer.json
welcome.info.yml
welcome.module
Install module
The module now exists but it is not enabled. You don’t need to go to the module page to enable it, you can install and enable the welcome module using the module:install command:
drupal module:install welcome
This will install the module and automatically rebuild the cache.