Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

time(1) [ultrix man page]

time(1) 						      General Commands Manual							   time(1)

       time - time a command

       time command
       /bin/time command

       The  command  lets  the specified command execute and then outputs the amount of elapsed real time, the time spent in the operating system,
       and the time spent in execution of the command.	Times are reported in seconds and are written to standard error.

       If you are using any shell except the C shell, you can give the command as shown on the first line of the Syntax section.  If you are using
       the  C shell, you must use the command's full pathname as shown on the second line of the Syntax section.  If you do not use the full path-
       name, will execute its own built-in command that supplies additional information and uses a different output format.

       The command can be used to cause a command to be timed no matter how much CPU time it takes.  For example:
       % /bin/time cp /etc/rc /usr/bill/rc
	       0.1 real 	0.0 user	 0.0 sys
       % /bin/time nroff sample1 > sample1.nroff
	       3.6 real 	2.4 user	 1.2 sys
       This example indicates that the command used negligible amounts of user and system time and had an elapsed time of 1/10 second (0.1).   The
       command used 2.4 seconds of user time and 1.2 seconds of system time, and required 3.6 seconds of elapsed time.

       Times are measured to an accuracy of 1/10 second.  Thus, the sum of the user and system times can be larger than the elapsed time.

See Also


Check Out this Related Man Page

rusage(1B)					     SunOS/BSD Compatibility Package Commands						rusage(1B)

rusage - print resource usage for a command SYNOPSIS
/usr/ucb/rusage command DESCRIPTION
The rusage command is similar to time(1). It runs the given command, which must be specified; that is, command is not optional as it is in the C shell's timing facility. When the command is complete, rusage displays the real (wall clock), the system CPU, and the user CPU times which elapsed during execution of the command, plus other fields in the rusage structure, all on one long line. Times are reported in sec- onds and hundredths of a second. EXAMPLES
Example 1 The format of rusage output The example below shows the format of rusage output. example% rusage wc /usr/share/man/man1/csh(1) 3045 13423 78071 /usr/share/man/man1/csh(1) 2.26 real 0.80 user 0.36 sys 11 pf 38 pr 0 sw 11 rb 0 wb 16 vcx 37 icx 24 mx 0 ix 1230 id 9 is example% Each of the fields identified corresponds to an element of the rusage structure, as described in getrusage(3C), as follows: real elapsed real time user ru_utime user time used sys ru_stime system time used pf ru_majflt page faults requiring physical I/O pr ru_minflt page faults not requiring physical I/O sw ru_nswap swaps rb ru_inblock block input operations wb ru_oublock block output operations vcx ru_nvcsw voluntary context switches icx ru_nivcsw involuntary context switches mx ru_maxrss maximum resident set size ix ru_ixrss currently 0 id ru_idrss integral resident set size is ru_isrss currently 0 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), time(1), getrusage(3C), attributes(5) BUGS
When the command being timed is interrupted, the timing values displayed may be inaccurate. SunOS 5.11 14 Sep 1992 rusage(1B)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

While we are on the subject of dates. Another date question

This goes deeper into the date thing. I want to be able to check the date and time stamp in or on a file to see what the time span is. We have a job that runs several times an hour - kicked off through cron based on a trigger file. We want to keep track of each run and check the time between... (14 Replies)
Discussion started by: MizzGail
14 Replies

2. Shell Programming and Scripting

syntax error in script !!

./ ./ Syntax error at line 24 : `then' is not expected. ================================= cat #!/bin/sh # # Parameter Settings ORA_LOG, ORA_SCRIPT, DBA_EMAIL_LIST -- (Set in .profile) bdf | sed "s/%/ /g" | sed "/Filesystem/d" |... (13 Replies)
Discussion started by: uuser
13 Replies

3. Shell Programming and Scripting

restrict the user not to key in more than 50 chars

When my script is run, it will ask the user to enter some text and the user should be restricted not to enter more than 50 chars. Is there any command which I can use with "read" command? Help me please (18 Replies)
Discussion started by: injeti
18 Replies

4. Shell Programming and Scripting

How to tweak up

I have a script like this: while read abbrev; do sed 's/'$(echo "$abbrev" | tr "" "")'/'"$abbrev"'/g' 'output_rgt.'$$ >'tmp.'$$ mv 'tmp.'$$ 'output_rgt.'$$ done<'dict.shortcuts.'$$ And I don't know how to leave "mv" out. ('dict.shortcuts.'$$ may be... (14 Replies)
Discussion started by: MartyIX
14 Replies

5. UNIX for Dummies Questions & Answers

Access time of a file

I thought that access time of a file is time when the file was run last time (or I read somewhere that it's time when system lookup the file -> but I'm not sure when it really is) How is it exactly? Thank you for help! (11 Replies)
Discussion started by: MartyIX
11 Replies

6. Shell Programming and Scripting

How to store the output of "time dd if= of=" in a variable

Hi All, I need to store the real seconds of the following command in a variable. How could it be done? time $(dd if=/dev/zero of=/dev/sda1 bs=512 count=2048;sync) Thanks, Amio (12 Replies)
Discussion started by: amio
12 Replies

7. Shell Programming and Scripting

Help with simple grep command

I am currently having a problem with displaying multiple occurences of a line using grep/sed combination. Let's say that I do grep "$anything" $file. When I do this it only displays a single line, but if I do grep -c "$anything" $file it says that there are 3 occurences of $anything, but how can... (15 Replies)
Discussion started by: puttster
15 Replies

8. AIX

Read input data within a specified period of time

Hi All, I am working on a script which requires an input from user within one 1 min. So if the user gives the required input within 1 min., it will execute on the basis of input provided by the user.Other wise it will execute on a default value(hard coded inside the script). Now, I am... (19 Replies)
Discussion started by: rajsharma
19 Replies

9. Shell Programming and Scripting

Script to adjust system time

Hello everyone, I am trying to write a script that will accomplish the following: - query current system time and store result into a variable - wait for some amount of time, say 300 seconds - reset system time to earlier queried time + 1 second I did some basic shell scripting (CSH... (11 Replies)
Discussion started by: xaiu
11 Replies

10. Shell Programming and Scripting

default blank line in end of file

Dear Experts, I have spent my full day looking for the solution..:wall:but could no resolved. Here it goes: I have a txt file say data.txt. The content is shown below: ************** datav1 datav2 datav3 *********** I have shown the blank line knowingly. If I open this txt file using... (12 Replies)
Discussion started by: nrjrasaxena
12 Replies

11. Shell Programming and Scripting

Removing cr,lf till number of fields are full

I have a file 1|2|3|4 a|b|c|d 1|2 3|4 a| b| c| d| The file should have 4 fields to load into a database. The file may have cr, lf, or end of line characters. What I want to see as output is 1|2|3|4 a|b|c|d 1|23|4 a|b|c|d I have tried (17 Replies)
Discussion started by: tampatim
17 Replies

12. Shell Programming and Scripting

Run a command for specific amount of time with an auto key press

Hi, I have been trying to do a small fun project for myself. I want to run a command for 45 seconds. And to get the final output of this command, the script requires I push the "q" key on my keyboard and then the final output file becomes available. I tried the following script. But it... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

13. Shell Programming and Scripting

Syntax error from cshrc, but not showing line number

Hi, I have been using ksh till now but was forced to use tcsh from last few days. I am getting a gvimrc error which says "set: Syntax error". What makes this pesky is that it is not showing which line number is the error from. How do I get the line number of the error? Also, I am using the... (11 Replies)
Discussion started by: rishikpillai90
11 Replies

14. UNIX for Dummies Questions & Answers

Rm command

(14 Replies)
Discussion started by: Andrshdz
14 Replies

15. Shell Programming and Scripting

How to pick system time of the file placed on UNIX?

Hi ,I got one data file from external source and I have to load it in database through sql loader. I want to add 2 columns in database,one is file name and one is time of the file received on server. -rwxr-x--- 1 user user 238 Jun 03 16:32 90936264971326030616.ctr From above case,... (21 Replies)
Discussion started by: Ruchika
21 Replies