CLI commands - where to run?

Hi

in the above video at the timestamp.

Running the Cli for magento why do we run it with the “bin/” part

In the directory /var/www/html

but the commands are run bin/magento --commandToRun

why do we not go into the bin directory and just run

magento --commantToRun

The magento script that is used to initiate any native magento commands is located inside <magento_root>/bin.

Therefore, when you’re running a command from the <magento_root> then you need to specify where the magento script is (i.e. bin/magento ...).

If you happened to be running the command from the bin/ folder then you wouldn’t need to specify a location because you’re already there.

You can run the command from anywhere on the server you like as long as you account for the location of the script (absolute or relative). It’s down to personal preference.

Great thank you, and thank you for adding the extra info. Very Grateful!