There's a timeout command that lets you limit the execution of any command by time, for example:

$ timeout 2s longprocess

Read more
Subscribe to Unix
Mastodon Mastodon