Back to the command reference

time

ShellFundamentals In simulator In real Linux

Time how long a command takes

Name: time

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

time runs a command and reports how long it took: real is elapsed time, user and sys are CPU time in user and kernel mode. bash has a time keyword and there is also a more detailed /usr/bin/time.

Syntax

time COMMAND

Common options

realWall-clock time
user / sysCPU time in user / kernel mode
-pPOSIX output: plain seconds, easy to read in scripts

Examples

  • $ time sort big.txt > /dev/null

    See how long a sort takes

    Explain

Related