有时候使用Magento2 的命令比较长比如:php bin/magento 我们可以简写。
简写的话必须使magento
命令全局化
登录服务器建立.bash_profile 文件
touch ~/.bash_profile
然后添加下面命令代码
alias magento="php bin/magento"
注销并重新登录或运行
source ~/.bash_profile
您可以将“ magento”更改为您想要的任何名称(即“ m”或“ mage”等)
我这里改成 “m2”


我们就可以进入到网站的根目录执行:“m2 c:c” 了
要从任何目录运行Magento命令,请添加<magento_root>/bin
到系统中PATH
适用于CentOS的示例bash shell:
export PATH=$PATH:/www/wwwroot/jaxpety.yingyanxt.com/bin

然后执行:
source ~/.bash_profile
现在可以在系统的任何目录运行mgento
