The title says it all!
I would like to know if it is possible to trigger an automation from a command line.
Yes, e.g. curl (call HA API), mosquitto_pub (update a MQTT topic that triggers the automation), and probably many other ways.
Edit: webhook which Taras writes about in the next post, is safer option (limited access, no token/user/pass).
There is an example of how to do it in the documentation for the Webhook Trigger. Your command line will use curl to trigger the automation’s Webhook Trigger.
Tell us more about your intended application for triggering an automation from a command line.
As @123 wrote: share with us what you are trying to achieve and maybe we can come up with suggestions/solutions.
Also, an automation has a trigger by itself and unless you need the same sequence of actions with that trigger, it makes more sense to use a script.