builtin

Bash times — report accumulated CPU time

Reports accumulated user and system CPU time for the shell and its children. It is not elapsed wall-clock duration. Values depend on the workload and machine; this example checks the shape rather than a fixed time. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): rows=2.

Formal Syntax & Structure

bash syntaxbash
times

Return Value

exit status

Zero on success; nonzero on failure.

Working Example

Example Snippetbash
times > times.txtmapfile -t rows < times.txt[[ ${#rows[@]} == 2 ]] || exit 1printf 'rows=%s\n' "${#rows[@]}"
Bash Reference