How to Run a Command with Time Limit in Bash Linux

Posted on April 6, 2019 at 2:48 pm

You can use “timeout” command to run a program and auto-kill it after N seconds:

timeout --signal=KILL 3 whois

The above command will auto-kill whois if it runs for more than 3 seconds.

Here is an example output in a Debian server:

root@server:~# timeout --signal=KILL 3 whois

More information here:

Receive updates via email

Other Posts

Updated Posts