Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

timeout

Kill command after specified time

Syntax

timeout [OPTION] DURATION COMMAND [ARG]...

Common Options

-sSpecify signal to send
-kSend SIGKILL after second duration
--foregroundForeground mode
-vVerbose output
-eDon't timeout on non-zero exit
--preserve-statusPreserve exit status on timeout

Common Examples

timeout 5s ping google.com

Kill ping after 5s

timeout 1m ./long_script.sh

Kill script after 1 minute

timeout -s SIGINT 10s command

Send SIGINT signal

timeout -k 30s 60s command

SIGTERM then SIGKILL

timeout --foreground 10s command

Foreground timeout

timeout 5 bash -c "while true; do echo hi; sleep 1; done"

Timeout control for loop

Related Commands

Related Tools

More Code & Dev Tools