For regular Linux users this is so obvious that it can’t be more obvious. For me and some others this is something that I keep forgetting and need this short memo to remember about this.
So, here it is. An easier Linux commands invocation or running Linux commands from every folder.
To be able to run command from everywhere, copy or move program or script into
sudo mv composer.phar /usr/local/bin/composer
You need to be able to run
sudo or log in as a root in order to achieve above.
If you can’t then install it in user-space, for example, in
~/bin/, and then add the path to your
mv composer.phar ~/bin/composer PATH=$PATH:~/bin/; export PATH
This will work only until end of your session, so you’ll be forced to repeat second command every time you open a terminal or log in to a remote system.
To make it as do-it-and-forget-it you can add it permanently to
PATH, as shown in the following:
echo "export PATH=$PATH:~/bin/;" >> ~/.bashrc
By adding the export statement to
.bashrc file you are making the directory searchable automatically every time you log in (assuming, you are using BASH as shell interpreter; you can check it, by executing