Process Management

timeout

Run a command with a time limit, killing it if it exceeds the duration.

Synopsis

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

Examples

Kill curl if it takes more than 30 seconds
timeout 30 curl https://example.com
TERM after 60s, KILL after 5 more seconds
timeout -k 5 60 ./long-task.sh
Hard kill ping after 10 seconds
timeout -s KILL 10 ping 8.8.8.8

Common options

FlagDescription
-sSignal to send on timeout (default TERM)
-kSend KILL signal after grace period
--foregroundAllow command to read from TTY
-vVerbose — diagnose to stderr on timeout

About timeout

The `timeout` command run a command with a time limit, killing it if it exceeds the duration. Process management commands let you monitor, control, and schedule running processes.

Linux is a multitasking operating system, and understanding how to list processes, send signals, adjust priorities, and manage background jobs is vital for system administration and debugging performance issues. The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man timeout`).

The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Process Management Commands

Other commands in the Process Management category

Related tools