Redirect output from time command to file

inode0 inode0 at gmail.com
Fri Nov 18 22:32:20 UTC 2005


On 11/18/05, Marcelino Mata <mmata at multimatic.com> wrote:
> 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

Try /usr/bin/time to run the GNU version of time instead of the shell
built-in version.

John




More information about the redhat-list mailing list