xref: /freebsd/usr.bin/time/time.1 (revision 5521ff5a4d1929056e7ffc982fac3341ca54df7c)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)time.1	8.1 (Berkeley) 6/6/93
33.\" $FreeBSD$
34.\"
35.Dd June 6, 1993
36.Dt TIME 1
37.Os BSD 4
38.Sh NAME
39.Nm time
40.Nd time command execution
41.Sh SYNOPSIS
42.Nm
43.Op Fl al
44.Op Fl h | Fl p
45.Op Fl o Ar file
46.Ar command
47.Sh DESCRIPTION
48The
49.Nm
50utility
51executes and
52times
53.Ar command
54by initiating a timer and passing the
55.Ar command
56to the
57shell.
58After the
59.Ar command
60finishes,
61.Nm
62writes to the standard error stream,
63(in seconds):
64the total time elapsed,
65the time used to execute the
66.Ar command
67process and the time consumed by system overhead.
68.Pp
69Available options:
70.Bl -tag -width Ds
71.It Fl a
72If the
73.Fl o
74flag is used, append to the specified file rather than overwriting
75it.
76Otherwise, this option has no effect.
77.It Fl h
78Print times in a human friendly format.  Times are printed in minutes, hours,
79etc. as appropiate.
80.It Fl l
81The contents of the
82.Em rusage
83structure are printed as well.
84.It Fl o Ar file
85Write the output to
86.Ar file
87instead of stderr.  If
88.Ar file
89exists and the
90.Fl a
91flag is not specified, the file will be overwritten.
92.It Fl p
93Makes
94.Nm
95output POSIX.2 compliant (each time is printed on its own line).
96.El
97.Pp
98Some shells may provide a builtin
99.Nm
100command which is similar or identical to this utility.
101Consult the
102.Xr builtin 1
103manual page.
104.Sh DIAGNOSTICS
105If
106.Ar command
107could be timed successfully, its exit status is returned.
108If
109.Ar command
110terminated abnormally, a warning message is output to stderr.
111If the
112.Ar command
113was found but could not be run, the exit status is 126.
114If no
115.Ar command
116could be found at all, the exit status is 127.
117If
118.Nm
119encounters any other error, the exit status is between 1 and 125
120included.
121.Sh SEE ALSO
122.Xr builtin 1 ,
123.Xr csh 1 ,
124.Xr getrusage 2 ,
125.Xr wait 2
126.Sh STANDARDS
127The
128.Nm
129utility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX'').
130.Sh HISTORY
131A
132.Nm
133command appeared in
134.At v6 .
135