Section: Linux User's Manual (1)
time - time a simple command or give resource usage
command runs the specified program
with the given arguments.
writes a message to standard error giving timing statistics
about this program run.
These statistics consist of (i) the elapsed real time
between invocation and termination, (ii) the user CPU time
(the sum of the
values in a
as returned by
and (iii) the system CPU time (the sum of the
values in a
as returned by
Note: some shells (e.g.,
have a built-in
command that provides similar information on the usage of time and
possibly other resources.
To access the real command, you may need to specify its pathname
When in the POSIX locale, use the precise traditional format
"real %f\nuser %f\nsys %f\n"
(with numbers in seconds)
where the number of decimals in the output for %f is unspecified
but is sufficient to express the clock tick accuracy, and at least one.
was invoked, the exit status is that of
Otherwise, it is 127 if
could not be found, 126 if it could be found but could not be invoked,
and some other nonzero value (1-125) if something else went wrong.
are used for the text and formatting of the output.
is used to search for
The remaining ones for the text and formatting of the output.
Below a description of the GNU 1.7 version of
Disregarding the name of the utility, GNU makes it output lots of
useful information, not only about time used, but also on other
resources like memory, I/O and IPC calls (where available).
The output is formatted using a format string that can be specified
option or the
The default format string is:
%Uuser %Ssystem %Eelapsed %PCPU (%Xtext+%Ddata %Mmax)k
%Iinputs+%Ooutputs (%Fmajor+%Rminor)pagefaults %Wswaps
option is given, the (portable) output format is used:
The format string
The format is interpreted in the usual printf-like way.
Ordinary characters are directly copied, tab, newline
and backslash are escaped using \t, \n and \\,
a percent sign is represented by %%, and otherwise %
indicates a conversion.
will always add a trailing newline itself.
The conversions follow.
All of those used by
Elapsed real time (in [hours:]minutes:seconds).
Elapsed real time (in seconds).
Total number of CPU-seconds that the process spent in kernel mode.
Total number of CPU-seconds that the process spent in user mode.
Percentage of the CPU that this job got, computed as (%U + %S) / %E.
Maximum resident set size of the process during its lifetime, in Kbytes.
Average resident set size of the process, in Kbytes.
Average total (data+stack+text) memory use of the process,
Average size of the process's unshared data area, in Kbytes.
Average size of the process's unshared stack space, in Kbytes.
Average size of the process's shared text space, in Kbytes.
System's page size, in bytes.
This is a per-system constant, but varies between systems.
Number of major page faults that occurred while the process was running.
These are faults where the page has to be read in from disk.
Number of minor, or recoverable, page faults.
These are faults for pages that are not valid but which have
not yet been claimed by other virtual pages.
Thus the data
in the page is still valid but the system tables must be updated.
Number of times the process was swapped out of main memory.
Number of times the process was context-switched involuntarily
(because the time slice expired).
Number of waits: times that the program was context-switched voluntarily,
for instance while waiting for an I/O operation to complete.
Number of filesystem inputs by the process.
Number of filesystem outputs by the process.
Number of socket messages received by the process.
Number of socket messages sent by the process.
Number of signals delivered to the process.
Name and command-line arguments of the command being timed.
Exit status of the command.
- -f format, --format=format
Specify output format, possibly overriding the format specified
in the environment variable TIME.
- -p, --portability
Use the portable output format.
- -o file, --output=file
Do not send the results to
but overwrite the specified file.
- -a, --append
(Used together with -o.) Do not overwrite but append.
- -v, --verbose
Give very verbose output about all the program knows about.
- -q, --quiet
Don't report abnormal program termination (where
is terminated by a signal) or nonzero exit status.
GNU standard options
Print a usage message on standard output and exit successfully.
- -V, --version
Print version information on standard output, then exit successfully.
Terminate option list.
Not all resources are measured by all versions of UNIX,
so some of the values might be reported as zero.
The present selection was mostly inspired by the data
provided by 4.2 or 4.3BSD.
GNU time version 1.7 is not yet localized.
Thus, it does not implement the POSIX requirements.
The environment variable
was badly chosen.
It is not unusual for systems like
to use environment variables with the name of a utility to override
the utility to be used.
Uses like MORE or TIME for options to programs
(instead of program pathnames) tend to lead to difficulties.
It seems unfortunate that
overwrites instead of appends.
(That is, the
option should be the default.)
Mail suggestions and bug reports for GNU
Please include the version of
which you can get by running
and the operating system
and C compiler you used.
This page is part of release 5.10 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at