utility

timeout

GNU utility that limits command duration. Default expiration status is 124, absent preserve-status or other special cases. Descendant cleanup is not universally guaranteed.

Formal Syntax & Structure

bash syntaxbash
timeout duration command [args ...]

Parameters & Attributes

NameTypeDescription
durationdurationTime limit, e.g. 1s.
commandexecutable and argumentsBounded command.

Return Value

exit status

GNU utility that limits command duration. Default expiration status is 124, absent preserve-status or other special cases. Descendant cleanup is not universally guaranteed.

Working Example

Example Snippetbash
timeout 1s bash -c 'printf "quick\n"'printf 'status=%s\n' "$?"
Bash Reference