Quickly measure how long a command runs and interpret real, user and sys times. 16.11.2025 | reading time: 2 min Want to know how long a command runs? Use the shell builtin and the GNU utility time to measure elapsed, user CPU and system CPU time quickly and reliably. Quick demo Run this in a terminal to see the simplest case: ```bash time sleep 1 ``` Typical output looks like: ```text real 0m1.003s user 0m0.000s sys 0m0.001s ``` Try it yourself to observe the "real" elapsed time versus CPU time. Useful variants to try Use the POSIX format for machine-friendly output with `time -p` or get detailed resource stats from the external GNU time with `/usr/bin/time -v` and custom formats; in bash set `TIMEFORMAT` to change the builtin's printed line; remember the shell builtin and the external program are different tools and may live in `/usr/bin`. Practical situations Measure pipelines and scripts to spot bottlenecks: prefix a pipeline with `time` to get the whole pipeline's elapsed time, wrap a function call in a script to time specific code paths, and combine time with loops to compute averages for short-running commands. Beyond simple timing When you need CPU-level details or system call information, pair time with profiling tools and system monitors; use time for quick checks, then move to deeper tools when the numbers demand investigation. Final steps Start timing commands now and build a habit of measuring before optimizing; if he wants structured learning, consider studying for CompTIA Linux+ or LPIC-1 and use bitsandbytes.academy for intensive exam preparation. Join Bits & Bytes Academy First class LINUX exam preparation. utilities processes scripting troubleshooting