19b50d902SRodney W. Grimes.\" Copyright (c) 1980, 1991, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 139b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 149b50d902SRodney W. Grimes.\" without specific prior written permission. 159b50d902SRodney W. Grimes.\" 169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b50d902SRodney W. Grimes.\" SUCH DAMAGE. 279b50d902SRodney W. Grimes.\" 289b50d902SRodney W. Grimes.\" @(#)time.1 8.1 (Berkeley) 6/6/93 29c3aac50fSPeter Wemm.\" $FreeBSD$ 309b50d902SRodney W. Grimes.\" 31*50f54dafSFernando Apesteguía.Dd July 7, 2020 329b50d902SRodney W. Grimes.Dt TIME 1 3362500372SRuslan Ermilov.Os 349b50d902SRodney W. Grimes.Sh NAME 359b50d902SRodney W. Grimes.Nm time 369b50d902SRodney W. Grimes.Nd time command execution 379b50d902SRodney W. Grimes.Sh SYNOPSIS 3880c486a4SPhilippe Charnier.Nm 39ea257bd5SDavid E. O'Brien.Op Fl al 40ea257bd5SDavid E. O'Brien.Op Fl h | Fl p 4128f5cafeSDag-Erling Smørgrav.Op Fl o Ar file 423f6c6c91STim J. Robbins.Ar utility Op Ar argument ... 439b50d902SRodney W. Grimes.Sh DESCRIPTION 449b50d902SRodney W. GrimesThe 4580c486a4SPhilippe Charnier.Nm 469b50d902SRodney W. Grimesutility 479b50d902SRodney W. Grimesexecutes and 4851ddbf58STim J. Robbinstimes the specified 4951ddbf58STim J. Robbins.Ar utility . 509b50d902SRodney W. GrimesAfter the 513f6c6c91STim J. Robbins.Ar utility 529b50d902SRodney W. Grimesfinishes, 5380c486a4SPhilippe Charnier.Nm 549b50d902SRodney W. Grimeswrites to the standard error stream, 559b50d902SRodney W. Grimes(in seconds): 569b50d902SRodney W. Grimesthe total time elapsed, 57844338c2SOllivier Robertthe time used to execute the 583f6c6c91STim J. Robbins.Ar utility 59844338c2SOllivier Robertprocess and the time consumed by system overhead. 609b50d902SRodney W. Grimes.Pp 6149b3830cSPhilippe CharnierThe following options are available: 6249b3830cSPhilippe Charnier.Bl -tag -width indent 6328f5cafeSDag-Erling Smørgrav.It Fl a 6428f5cafeSDag-Erling SmørgravIf the 6528f5cafeSDag-Erling Smørgrav.Fl o 6628f5cafeSDag-Erling Smørgravflag is used, append to the specified file rather than overwriting 67e6d3cf26SSheldon Hearnit. 68e6d3cf26SSheldon HearnOtherwise, this option has no effect. 69ea257bd5SDavid E. O'Brien.It Fl h 706a3e8b0aSRuslan ErmilovPrint times in a human friendly format. 716a3e8b0aSRuslan ErmilovTimes are printed in minutes, hours, 726a3e8b0aSRuslan Ermilovetc.\& as appropriate. 739b81ca85SDag-Erling Smørgrav.It Fl l 749b81ca85SDag-Erling SmørgravThe contents of the 759b81ca85SDag-Erling Smørgrav.Em rusage 769b81ca85SDag-Erling Smørgravstructure are printed as well. 77fabfd133SDag-Erling Smørgrav.It Fl o Ar file 7803a22248SPoul-Henning KampWrite the output to 7903a22248SPoul-Henning Kamp.Ar file 806a3e8b0aSRuslan Ermilovinstead of stderr. 816a3e8b0aSRuslan ErmilovIf 8203a22248SPoul-Henning Kamp.Ar file 8328f5cafeSDag-Erling Smørgravexists and the 8428f5cafeSDag-Erling Smørgrav.Fl a 8528f5cafeSDag-Erling Smørgravflag is not specified, the file will be overwritten. 86844338c2SOllivier Robert.It Fl p 87844338c2SOllivier RobertMakes 88844338c2SOllivier Robert.Nm 89844338c2SOllivier Robertoutput POSIX.2 compliant (each time is printed on its own line). 909b50d902SRodney W. Grimes.El 919b50d902SRodney W. Grimes.Pp 92c644db6aSSheldon HearnSome shells may provide a builtin 93c644db6aSSheldon Hearn.Nm 94e6d3cf26SSheldon Hearncommand which is similar or identical to this utility. 95e6d3cf26SSheldon HearnConsult the 96c644db6aSSheldon Hearn.Xr builtin 1 97c644db6aSSheldon Hearnmanual page. 98b6d7073dSPawel Jakub Dawidek.Pp 99b6d7073dSPawel Jakub DawidekIf 100b6d7073dSPawel Jakub Dawidek.Nm 101b6d7073dSPawel Jakub Dawidekreceives a 102b6d7073dSPawel Jakub Dawidek.Dv SIGINFO 103b6d7073dSPawel Jakub Dawidek(see the status argument for 104b6d7073dSPawel Jakub Dawidek.Xr stty 1 ) 105b6d7073dSPawel Jakub Dawideksignal, the current time the given command is running will be written to the 106b6d7073dSPawel Jakub Dawidekstandard output. 1078b4f995aSTim J. Robbins.Sh ENVIRONMENT 1088b4f995aSTim J. RobbinsThe 1098b4f995aSTim J. Robbins.Ev PATH 1108b4f995aSTim J. Robbinsenvironment variable is used to locate the requested 1118b4f995aSTim J. Robbins.Ar utility 1128b4f995aSTim J. Robbinsif the name contains no 1138b4f995aSTim J. Robbins.Ql / 1148b4f995aSTim J. Robbinscharacters. 115a866e170SRuslan Ermilov.Sh EXIT STATUS 116844338c2SOllivier RobertIf 1173f6c6c91STim J. Robbins.Ar utility 118e6d3cf26SSheldon Hearncould be timed successfully, its exit status is returned. 119e6d3cf26SSheldon HearnIf 1203f6c6c91STim J. Robbins.Ar utility 121844338c2SOllivier Robertterminated abnormally, a warning message is output to stderr. 122844338c2SOllivier RobertIf the 1233f6c6c91STim J. Robbins.Ar utility 124844338c2SOllivier Robertwas found but could not be run, the exit status is 126. 125844338c2SOllivier RobertIf no 1263f6c6c91STim J. Robbins.Ar utility 127844338c2SOllivier Robertcould be found at all, the exit status is 127. 128844338c2SOllivier RobertIf 129844338c2SOllivier Robert.Nm 130844338c2SOllivier Robertencounters any other error, the exit status is between 1 and 125 131844338c2SOllivier Robertincluded. 132*50f54dafSFernando Apesteguía.Sh EXAMPLES 133*50f54dafSFernando ApesteguíaTime the execution of 134*50f54dafSFernando Apesteguía.Xr ls 1 135*50f54dafSFernando Apesteguíaon an empty directory: 136*50f54dafSFernando Apesteguía.Bd -literal -offset indent 137*50f54dafSFernando Apesteguía$ /usr/bin/time ls 138*50f54dafSFernando Apesteguía 0.00 real 0.00 user 0.00 sys 139*50f54dafSFernando Apesteguía.Ed 140*50f54dafSFernando Apesteguía.Pp 141*50f54dafSFernando ApesteguíaTime the execution of the 142*50f54dafSFernando Apesteguía.Xr cp 1 143*50f54dafSFernando Apesteguíacommand and store the result in the 144*50f54dafSFernando Apesteguía.Pa times.txt 145*50f54dafSFernando Apesteguíafile. 146*50f54dafSFernando ApesteguíaThen execute the command again to make a new copy and add the result to the same 147*50f54dafSFernando Apesteguíafile: 148*50f54dafSFernando Apesteguía.Bd -literal -offset indent 149*50f54dafSFernando Apesteguía$ /usr/bin/time -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy1.iso 150*50f54dafSFernando Apesteguía$ /usr/bin/time -a -o times.txt cp FreeBSD-12.1-RELEASE-amd64-bootonly.iso copy2.iso 151*50f54dafSFernando Apesteguía.Ed 152*50f54dafSFernando Apesteguía.Pp 153*50f54dafSFernando ApesteguíaThe 154*50f54dafSFernando Apesteguía.Pa times.txt 155*50f54dafSFernando Apesteguíafile will contain the times of both commands: 156*50f54dafSFernando Apesteguía.Bd -literal -offset indent 157*50f54dafSFernando Apesteguía$ cat times.txt 158*50f54dafSFernando Apesteguía 0.68 real 0.00 user 0.22 sys 159*50f54dafSFernando Apesteguía 0.67 real 0.00 user 0.21 sys 160*50f54dafSFernando Apesteguía.Ed 161*50f54dafSFernando Apesteguía.Pp 162*50f54dafSFernando ApesteguíaTime the 163*50f54dafSFernando Apesteguía.Xr sleep 1 164*50f54dafSFernando Apesteguíacommand and show the results in a human friendly format. 165*50f54dafSFernando ApesteguíaShow the contents of the 166*50f54dafSFernando Apesteguía.Em rusage 167*50f54dafSFernando Apesteguíastructure too: 168*50f54dafSFernando Apesteguía.Bd -literal -offset indent 169*50f54dafSFernando Apesteguía$ /usr/bin/time -l -h -p sleep 5 170*50f54dafSFernando Apesteguíareal 5.01 171*50f54dafSFernando Apesteguíauser 0.00 172*50f54dafSFernando Apesteguíasys 0.00 173*50f54dafSFernando Apesteguía 0 maximum resident set size 174*50f54dafSFernando Apesteguía 0 average shared memory size 175*50f54dafSFernando Apesteguía 0 average unshared data size 176*50f54dafSFernando Apesteguía 0 average unshared stack size 177*50f54dafSFernando Apesteguía 80 page reclaims 178*50f54dafSFernando Apesteguía 0 page faults 179*50f54dafSFernando Apesteguía 0 swaps 180*50f54dafSFernando Apesteguía 1 block input operations 181*50f54dafSFernando Apesteguía 0 block output operations 182*50f54dafSFernando Apesteguía 0 messages sent 183*50f54dafSFernando Apesteguía 0 messages received 184*50f54dafSFernando Apesteguía 0 signals received 185*50f54dafSFernando Apesteguía 3 voluntary context switches 186*50f54dafSFernando Apesteguía 0 involuntary context switches 187*50f54dafSFernando Apesteguía.Ed 1889b50d902SRodney W. Grimes.Sh SEE ALSO 189c644db6aSSheldon Hearn.Xr builtin 1 , 1906836c26dSMike Pritchard.Xr csh 1 , 1916836c26dSMike Pritchard.Xr getrusage 2 , 1926836c26dSMike Pritchard.Xr wait 2 193844338c2SOllivier Robert.Sh STANDARDS 194844338c2SOllivier RobertThe 195844338c2SOllivier Robert.Nm 196844338c2SOllivier Robertutility is expected to conform to ISO/IEC 9945-2:1993 (``POSIX''). 1979b50d902SRodney W. Grimes.Sh HISTORY 1989b50d902SRodney W. GrimesA 1999b50d902SRodney W. Grimes.Nm 20049b3830cSPhilippe Charnierutility appeared in 201780c7a87STim J. Robbins.At v3 . 202