Linux and Unix time command

Quick links

About time
Syntax
Examples
Related commands
Linux and Unix main page

About time

Report how long it took for a command to execute.

Syntax

time [-p] command [arguments...]

Description

The time command runs the specified program command with the given arguments. When command finishes, time writes a message to standard output giving timing statistics about this program run. These statistics consist of:

  • the elapsed real time between invocation and termination,
  • the user CPU time, and
  • the system CPU time.

Options

-p If -p is specified, the timing summary is printed in a portable POSIX format.

Examples

time df

Calculates free disk space using the df command, and reports how long it took for the command to complete. Output of this command would resemble the following:

Filesystem    1K-blocks    Used Available Use% Mounted on
rootfs          7867856 3694744   3773448  50% /
udev              10240       0     10240   0% /dev
tmpfs            207456     580    206876   1% /run
tmpfs              5120       0      5120   0% /run/lock
tmpfs            493340      84    493256   1% /run/shm

real    0m0.116s
user    0m0.004s
sys     0m0.008s

Related commands

csh — The C shell command interpreter.
date — Output the current date and time.
timex — Report process data and system activity for a specified command.