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
| Name | Type | Description |
|---|---|---|
| duration | duration | Time limit, e.g. 1s. |
| command | executable and arguments | Bounded 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' "$?"