Time a command
give resource usage
time [options] command [arguments…]
command arguments , then writes a message to standard error including:
- elapsed wall time
- user CPU time (
tms_utime + tms_cutime )
- system CPU time (
tms_stime + tms_cstime )
5.6 wall 0.127 user 0.571 sys 12.45%
-p When in the POSIX locale, use format:
real %f\nuser %f\nsys %f\n
(in seconds) with the number of decimals in the output
sufficient to express the clock tick accuracy plus 1.
LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and
LC_NUMERIC are used for formatting the output and
PATH to search for
is that of
command was invoked.
command could not be found,
command found but could not be invoked,
1-125 something else went wrong. (ambigious with exit status of
STDOUT (Unfortunately becoming part of the output
from the command being timed!)
time used, memory, I/O and IPC calls.
Format string specified using
-f or the
TIME environment variable.
The default format string is
%Uuser %Ssystem %Eelapsed %P%%CPU
cp_backup etc mail tmp
cp.1.html du6.txt lslrClean.sed public_html
0.00user 0.00system 0:00.00elapsed 75%CPU (0avgtext+0avgdata 3616maxresident)k
0inputs+0outputs (0major+258minor)pagefaults 0swaps
Perhaps a more useful format would be :
/usr/bin/time -f "%E %Ssys %Uusr " command
1:05.51mm:ss.ss, 2.39K 0.77U
/usr/bin/time -f "%e %Ssys %Uusr " command
1:05.51mm:ss.ss, 65.51sss.ss, 2.39K 0.77U
Output includes a trailing newline
In the format, ordinary characters are copied, for tab, newline and backslash
\t, \n and
\\, for a percent sign use
% indicates a conversion.
Options in darkGreen are not available is
|Elapsed real time (in [hours:]minutes:seconds).
| Elapsed real time (in seconds).
| CPU-seconds spent in kernel mode.
| CPU-seconds spent in user mode.
| Percentage of the CPU, computed as |
(%U + %S) / %E.
|file system inputs
| file system outputs
| socket messages received
| socket messages sent
| signals delivered to the process.
| command and arguments
| Exit status of the command.
| System's page size, in bytes. |
|Memory (sizes in KBytes)
| Maximum resident set size
| Average resident set size
| Average total (data+stack+text) memory use
| Average size of the unshared data area
|Average size of the unshared stack space
| Average size of the shared text space
| page faults where the page was read in from disk.
| page faults that are not valid but which have not yet been claimed by other virtual pages.|
the data in the page is still valid but the system tables must be updated.
|swapped out of main memory.
| context-switched involuntarily (time slice expired).
|waits: times that the program was context-switched voluntarily, |
for instance while waiting for an I/O operation to complete.
| overriding format specified by environment variable |
| output format|
| append output to file
User time (seconds): 0.46
System time (seconds): 0.04
Percent of CPU this job got: 98%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.51
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 183
Voluntary context switches: 1
Involuntary context switches: 50
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 1
User time (seconds): 5.97
System time (seconds): 0.03
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:06.02
Maximum resident set size (kbytes): 6208
Voluntary context switches: 1
Involuntary context switches: 2137
Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version] [--help] command [arg...]
| end of options
Not all resources are measured by all versions of Unix, so some of the values might be reported as zero.
The environment variable
TIME was poorly chosen.
-o overwrites instead of appends. (That is, the
-a option should be the default.)
See also tcsh, wait3
stdout the user and system times used by the shell and its children since being invoked.
The return status is 0.