stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Commonly used Magento 2 commands

    Display the cron jobs

    crontab -l

    Install the cron jobs

    php bin/magento cron:install

    Reindex

    php bin/magento indexer:reindex

    Disable the cache

    php bin/magento cache:disable

    Enable a module

    php bin/magento module:enable Vendor_ModuleName

    php bin/magento setup:upgrade

    Check status of modules

    php bin/magento module:status

    Flush the cache

    php bin/magento cache:flush

    Clean the cache

    php bin/magento cache:clean

    Compile classes

    php bin/magento setup:di:compile

    Set Magento to developer mode

    php bin/magento deploy:mode:set developer

    Check the Magento mode

    php bin/magento deploy:mode:show

    Publish assets for an area

    Example for Back-end (adminhtml):

    php bin/magento setup:static-content:deploy en_US -a adminhtml -f

    Example for Front-end (frontend):

    php bin/magento setup:static-content:deploy en_GB -a frontend -t YourTheme/YourTheme -f

    Example for both areas (adminhtml & frontend):

    php bin/magento setup:static-content:deploy -f en_GB en_US

    Generate factory classes

    sudo chmod -R 777 generated/

    php bin/magento setup:di:compile

    Unlock an admin user

    php bin/magento admin:user:unlock AdminUsernamE

    Show query from collection

    echo $collection->getSelect()->__toString();