Alarm clock Set Timeout For A Shell Command

Originally published at: https://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/

How can I run a command called foo, and have it timeout/abort after 10 seconds under GNU/Linux running bash shell or script? How do I run the command under an alarm clock?