Linux run a command with a time limit (timeout)

Originally published at:

I want to start command called foo, and kill it if still running after given DURATION in seconds. How do I run a command a time Limit on Linux? How do I run a Linux command, and have it timeout (abort) after N seconds? Can you give timeout command examples in Linux?