Redirect output from time command to file
Marcelino Mata
mmata at multimatic.com
Fri Nov 18 21:57:03 UTC 2005
Running RHEL 3.0 x86_64 and RH9.
I have searched the internet for over 2 hours looking for this
information...this should be easy...according to various sites it should
just work.
I am trying to log the time a command takes to a log file with the
"time" command. For example, the time below measures how long time it
took for wc to count the text in /etc/hosts.
# time wc /etc/hosts
72 332 2762 /etc/hosts
real 0m0.002s
user 0m0.000s
sys 0m0.000s
According to time manual I can redirect actual values to a file with the
-o or --output option. Example shown below, long it took the wc command
to perform the operation:
time --output=log wc /etc/hosts
However, all I get is this
-bash: --output=log: command not found
See http://www.ss64.com/bash/time.html for online manual on time.
"man time" shows this
GNU OPTIONS
-o FILE, --output=FILE
Do not send the results to stderr, but overwrite the
specified
file.
Is Redhat not running GNU Time? Does GNU OPTIONS under man pages mean
it only works in GNU version of time? What version is Redhat using?
Is there another way to redirect output without -o option. I tried 2>
and 1> and it did not work, for example
time wc /etc/hosts 2> file.txt
time wc /etc/hosts 1> file.txt
I tried it under bash, csh and ksh.
Marcelino
More information about the redhat-list
mailing list