time
Command
The time
command runs another program, then displays information
about the resources used by that program, collected by the system while
the program was running. You can select which information is reported
and the format in which it is shown (see section Setting the Output Format), or have
time
save the information in a file instead of displaying it on the
screen (see section Redirecting Output).
The resources that time
can report on fall into the general
categories of time, memory, and I/O and IPC calls. Some systems do not
provide much information about program resource use; time
reports unavailable information as zero values (see section Accuracy).
The format of the time
command is:
time [option...] command [arg...]
time
runs the program command, with any given arguments
arg.... When command finishes, time
displays
information about resources used by command.
Here is an example of using time
to measure the time and other
resources used by running the program grep
:
eg$ time grep nobody /etc/aliases nobody:/dev/null etc-files:nobody misc-group:nobody 0.07user 0.50system 0:06.69elapsed 8%CPU (0avgtext+489avgdata 324maxresident)k 46inputs+7outputs (43major+251minor)pagefaults 0swaps
Mail suggestions and bug reports for GNU time
to
bug-gnu-utils@prep.ai.mit.edu
. Please include the version of
time
, which you can get by running `time --version', and the
operating system and C compiler you used.
time
uses a format string to determine which information to
display about the resources used by the command it runs. See section The Format String, for the interpretation of the format string contents.
You can specify a format string with the command line options listed
below. If no format is specified on the command line, but the
TIME
environment variable is set, its value is used as the format
string. Otherwise, the default format built into time
is used:
%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k %Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
The command line options to set the format are:
-f format
--format=format
-p