Running commands

For the bash shell, use the following syntax to switch to the file system owner and enter the command at the same time:

su <file system owner> -s /bin/bash -c <command>

If the file system owner does not allow logins, you can use the following:

sudo -u <file system owner> <command>

To run CLI commands from any directory:

Add <magento_root>/bin to your system PATH.

Sample bash shell for CentOS:

export PATH=$PATH:/var/www/html/magento2/bin

Optionally, you can run the following:

  • cd <magento_root>/bin and run them as ./magento <command name>
  • <magento_root>/bin/magento <command name>
  • <magento_root> is a subdirectory of your web server docroot
Previous pageStatic content cache
Next pageCommon commands

Commerce