Commands in Magento - Kussin | Development Unit Macedonia

Commands in Magento

commands, CLI, cache

11.08.2023 | Enisa Abazi | Blog, Development

Most used Commands in Magento 2

Magento 2 provides a powerful command-line interface (CLI) that allows you to perform various tasks related to development, administration, and maintenance of your Magento store. Here are some commonly used command lines in Magento 2:

1. Clear Cache:

Clears the cache to ensure that your changes are reflected on the storefront.

2. Compile Code:

Compiles the code and generates necessary classes for better performance.

3. Run Database Migrations:

Applies database schema and data changes from modules.

4. Reindex Data:

Rebuilds all or specific indexers.

5. Deploy Static Content:

Deploys static view files for storefront themes.

6. Enable/Disable Modules:

Enables or disables specific modules.

7. Create Admin User:

Creates an admin user for the Magento Admin Panel.

8. Generate CRUD Module:

Generates a basic CRUD module to manage database records.

9. Flush Redis Cache:

Flushes Redis cache (if configured).

10. Check Magento Version:

Displays the current Magento version.

11. Compile Translations:

Commands related to translations, including collecting phrases and creating language packs.

12. Backup and Restore Database:

bin/magento setup:backup [–code] [–db] [–media] [–exclude-log-files] [–magento-init-params=”MAGE_MODE=developer”]
bin/magento setup:rollback [–code] [–db] [–media] [–exclude-log-files] [–magento-init-params=”MAGE_MODE=developer”]

Creates backups of your application code, database, and media files, and allows for rollback.

These are just a few examples of the many command-line commands available in Magento 2. You can run `bin/magento` without any arguments to see a list of available commands. Additionally, you can append `–help` to any command to get more information about its usage and available options.

Remember to run the commands from the root directory of your Magento installation, and replace `bin/magento` with `php bin/magento` if needed.

[contact-form-7 404 "Not Found"]