Command line command to auto-kill a command after a certain amount of time

GNU Coreutils includes the timeout command, installed by default on many systems.

https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html

To watch free -m for one minute, then kill it by sending a TERM signal:

timeout 1m watch free -m

Leave a Comment