# Zsh: measure command durations with the time command, TIMEFMT, and REPORTTIME

DevFeed: [Zsh: measure command durations with the time command, TIMEFMT, and REPORTTIME](<https://devfeed.tech/articles/zsh-measure-command-durations-with-the-time-command-timefmt-and-reporttime-126493.md>)

Original publisher: [Read original article](<https://adamj.eu/tech/2026/11/09/zsh-time/>)

Author: Adam Johnson

Published: 2026-11-09T00:00:00Z

Content type: article

Language: en

Sources: [Adam Johnson](<https://devfeed.tech/sources/adam-johnson.md>)

Topics: [Zsh](<https://devfeed.tech/topics/zsh.md>), [Shell](<https://devfeed.tech/topics/shell.md>), [POSIX](<https://devfeed.tech/topics/posix.md>), [Bash](<https://devfeed.tech/topics/bash.md>)

Tags: [bash](<https://devfeed.tech/tags/bash.md>), [cpu-time](<https://devfeed.tech/tags/cpu-time.md>), [posix](<https://devfeed.tech/tags/posix.md>), [time](<https://devfeed.tech/tags/time.md>), [zsh](<https://devfeed.tech/tags/zsh.md>)

## AI overview

Zsh's built-in `time` reports a command's user and system CPU time, CPU percentage, and elapsed time in one line; its figures have the same meanings as Bash's `real`, `user`, and `sys` values, though Bash formats them across three lines. CPU percentage can help indicate whether a command is computing or waiting, and values above 100% indicate use of multiple cores. Zsh reports pipeline commands separately; wrap a pipeline, multiple commands, a brace group, or a shell function in parentheses to time them together. Customize output with `TIMEFMT`, which can use different time precision and include resource statistics such as maximum memory. The `%M` memory unit differs by OS: the article reports kilobytes on macOS and megabytes on Linux due to a long-standing bug. Set `REPORTTIME` to report commands above a CPU-time threshold; commands that mostly wait may not trigger it.

## Source excerpt

time is a POSIX utility for timing commands. Most shells build it in, and Zsh's version has a lot more to offer than the one in Bash. Put time before a command to time it. For example, to time a Python script: $ time python example.py python example.py ...