How to run Asterisk command from shell

Use

asterisk -rx "[command]"

to run an Asterisk command (-x) in an already running Asterisk server (-r), for example:

asterisk -rx "core restart now"