GNU version
Time a command
give resource usage

/usr/bin/time [options] command [arguments…]

Runs command arguments , then writes a message to standard error including:

  1. elapsed wall time
  2. user CPU time     (tms_utime + tms_cutime )
  3. 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.

real 0.88
user 0.12
sys 0.32

Environment variables

LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and LC_NUMERIC are used for formatting the output and
NLSPATH and PATH to search for command.

Exit status

is that of command. if command was invoked.
127 command could not be found,
126 command found but could not be invoked,
1-125 something else went wrong. (ambigious with exit status of command.

GNU version

Output to 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 (%Xavgtext+%Davgdata %Mmaxresident)k
 %Iinputs+%Ooutputs (%Fmajor+%%Rminor)pagefaults %Wswaps

/usr/bin/time /bin/ls 
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, 2.39K 0.77U
/usr/bin/time -f "%e %Ssys %Uusr " command,, 2.39K 0.77U

Output includes a trailing newline
In the format, ordinary characters are copied, for tab, newline and backslash use \t, \n and \\, for a percent sign use %%.
% indicates a conversion.
Options in darkGreen are not available is tsch

%E Elapsed real time (in [hours:]minutes:seconds).
%e Elapsed real time (in seconds).
%S CPU-seconds spent in kernel mode.
%U CPU-seconds spent in user mode.
%P Percentage of the CPU, computed as (%U + %S) / %E.
%I file system inputs
%O file system outputs
%r socket messages received
%s socket messages sent
%k signals delivered to the process.
%C command and arguments
%x Exit status of the command.
%Z System's page size, in bytes.
per-system constant
Memory (sizes in KBytes)
%M Maximum resident set size
%t Average resident set size
%K Average total (data+stack+text) memory use
%D Average size of the unshared data area
%p Average size of the unshared stack space
%X Average size of the shared text space
%F page faults where the page was read in from disk.
%R 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.
%W swapped out of main memory.
%c context-switched involuntarily (time slice expired).
%w 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 TIME.
output format
real %e
user %U
sys %S
-o file
overwrite file. Default!
-ao file
--append --output=file
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
Swaps: 0
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

bash builtin:


Output to stdout the user and system times used by the shell and its children since being invoked.

0m0.060s 0m0.260s
0m1.250s 0m2.240s

The return status is 0.