times — Show accumulated CPU time used by the shell and its children across all 5 shells
Equivalents in every shell
timesBuiltin (POSIX). Prints two lines: `user system` for the shell itself, then `user system` for all completed CHILDREN. Times are CUMULATIVE since the shell started and reset only when a new shell is spawned. No options, no per-command timing.
timesBuiltin, same POSIX semantics and output as bash. Zsh also exposes `$SECONDS` (elapsed wall clock since shell start) and the `time` keyword for per-command timing — `times` is the only way to get cumulative totals split between shell and children.
time some_commandFish does NOT implement POSIX `times`. The closest is `time some_command` (per-pipeline timing via the `time` keyword) or polling `(string split " " (cat /proc/$fish_pid/stat))[14..17]` on Linux for raw clock ticks. There is no single-command cumulative summary.
(Get-Process -Id $PID).CPUReturns the host process's total CPU seconds (user + kernel, accumulated). For separate user vs. kernel splits, `.UserProcessorTime` and `.PrivilegedProcessorTime`. Child processes are NOT included unless you sum descendants yourself.
wmic process get Name,UserModeTime,KernelModeTimeCmd has no equivalent built-in. WMIC reports CPU time per process (100ns units). The cmd `time` keyword SETS the system clock instead of measuring. For accurate per-shell totals, shell out to PowerShell `(Get-Process -Id $PID).CPU` from inside cmd.
Worked examples
Print accumulated CPU time used so far
timestimes(Get-Process -Id $PID).CPUCompare CPU spent in the shell vs. its children
times # line 1: shell, line 2: childrentimes # line 1: shell, line 2: children$p = Get-Process -Id $PID; "$($p.UserProcessorTime) user; $($p.PrivilegedProcessorTime) kernel"Time a single command instead (not what times does)
time some_commandtime some_commandtime some_commandMeasure-Command { some_command }Gotchas
- `times` reports CUMULATIVE time since the shell started — it is NOT a per-command stopwatch. For per-command timing use the `time` keyword. Scripts that print `times` before and after a command and subtract get a noisy answer dominated by shell overhead, not the command.
- The two output lines are `shell-user shell-system` then `children-user children-system`. Order matters and the format is FIXED — no `times -p` or `--format` option. Parsing scripts must handle the exact `Xm Ys.NNNs` layout (one space between user and system; no trailing newline on some shells).
- Fish has no `times` builtin and no plan to add one — its maintainers consider per-command `time` sufficient. Bash / zsh scripts ported to fish that rely on `times` for accounting must be reworked to use `/usr/bin/time -v` or sum `getrusage` from a wrapper.
- PowerShell `(Get-Process -Id $PID).CPU` measures only the CURRENT process. Bash `times` ALSO accumulates from already-reaped children — pwsh has no automatic accumulator. Sum descendants manually with `Get-Process | ? Parent -eq $PID` or use `Get-Counter` for system-wide totals.
- Cmd `time` SETS the wall clock instead of measuring CPU time — running `time` opens the interactive clock-set prompt. Always reach for PowerShell or WMIC for any CPU-time question on cmd; the legacy shell has no native facility.