LIVEReading: Benchmark Any Command in Seconds with HyperfineTotal time: 5 minSteps: 6Worked first time: 95% LIVEReading: Benchmark Any Command in Seconds with HyperfineTotal time: 5 minSteps: 6Worked first time: 95%
CBW
Benchmark Any Command in Seconds with Hyperfine
Easygithub.com/sharkdp/hyperfine2026-06-24

Benchmark Any Command in Seconds with Hyperfine

Hyperfine times any shell command with statistical rigor — mean, min, max, and outlier detection. No coding required, just install and run.

// Build stats

  • Total time5 min
  • Number of steps6
  • DifficultyEasy
  • Worked first time95%
// Before you start

What you need

  • A terminal (Mac, Linux, or Windows)
  • Admin/sudo access for installation
  • At least one command you want to time
01
Step 1 of 6

Install hyperfine

2 min

Pick the one-liner that matches your operating system. Each command downloads and installs hyperfine from your system's official package repository. You only need to run one of these.

Terminal · mac
$ # Ubuntu or Debian
$ sudo apt install hyperfine
$
$ # Fedora
$ sudo dnf install hyperfine
$
$ # Arch Linux
$ sudo pacman -S hyperfine
$
$ # Alpine Linux
$ sudo apk add hyperfine
$
$ # macOS (Homebrew)
$ brew install hyperfine
$
$ # Windows (Winget)
$ winget install hyperfine
What you should see
Installation completes with no errors. You return to a normal prompt.
This might happen

apt install hyperfine says package not found on older Ubuntu

Download the .deb file directly instead: wget https://github.com/sharkdp/hyperfine/releases/download/v1.20.0/hyperfine_1.20.0_amd64.deb && sudo dpkg -i hyperfine_1.20.0_amd64.deb

02
Step 2 of 6

Confirm the install worked

1 min

Run a quick version check so you know hyperfine is on your PATH before you do anything else.

Terminal · mac
$ hyperfine --version
What you should see
hyperfine 1.20.0 (or similar version number)
This might happen

command not found after install

Close your terminal and open a new one, then try again. On Windows, restart the terminal entirely.

03
Step 3 of 6

Run your first benchmark

1 min

This times the built-in sleep command for 0.3 seconds. It is a safe, harmless test that shows you exactly what hyperfine output looks like. Hyperfine will run the command at least 10 times and for at least 3 seconds, then report statistics.

Terminal · mac
$ hyperfine 'sleep 0.3'
What you should see
A progress bar appears, then a summary table showing mean time (~300 ms), standard deviation, min, and max across all runs.
04
Step 4 of 6

Compare two commands head-to-head

2 min

Pass two commands as separate quoted arguments. Hyperfine runs both, then prints a comparison table showing which is faster and by how much. Replace the two example commands with any two commands you actually want to compare.

Terminal · mac
$ hyperfine 'find . -name "*.txt"' 'ls -R | grep ".txt"'
What you should see
Two rows in the results table, each with mean/min/max times and a 'Relative' column showing the speed ratio between them.
This might happen

One command errors out mid-benchmark

Test each command on its own in the terminal first to make sure it runs cleanly, then pass both to hyperfine.

05
Step 5 of 6

Add warmup runs for disk-heavy commands

2 min

Commands that read files are faster the second time because the OS caches the data. Adding --warmup 3 makes hyperfine run the command 3 times before it starts measuring, so your results reflect a warm cache rather than a cold one. This gives more realistic numbers for everyday use.

Terminal · mac
$ hyperfine --warmup 3 'grep -r TODO .'
What you should see
Hyperfine shows a 'Performing warmup runs' line before the benchmark starts, then the usual results table.
06
Step 6 of 6

Export results to a Markdown table

1 min

Add --export-markdown results.md to save a formatted table to a file. You can paste this table directly into GitHub READMEs, Notion, or any Markdown editor. The file is created in whatever folder your terminal is currently in.

Terminal · mac
$ hyperfine --warmup 3 --export-markdown results.md 'find . -name "*.txt"' 'ls -R | grep ".txt"'
What you should see
Benchmark runs as normal. Afterwards, a file called results.md appears in the current folder containing a Markdown table.
This might happen

results.md is empty or missing

Make sure you have write permission in the current folder. Try running the command from your home directory: cd ~ then repeat.

// Status

cooked. baked. worked.

A working hyperfine install that can time any shell command, compare two commands side by side, and export results to a Markdown file you can share.

// the honest bit

The honest part

Hyperfine measures wall-clock time, not CPU time, so background activity on your machine can add noise. Results are most reliable on an otherwise idle computer. It cannot profile why something is slow — only how long it takes. The parameterized benchmark feature (--parameter-scan) is powerful but requires you to understand the command you are varying; it is not covered here.