abubacker abubacker - 2 years ago 60
Bash Question

How can I redirect the output of the "time" command?

I tried to redirect the output of the time command, but I couldn't:

$time ls > filename
real 0m0.000s
user 0m0.000s
sys 0m0.000s

In the file I can see the output of the
command, not that of
Please explain, why I couldn't and how to do this.

Answer Source

you can redirect the time output using,

(time ls) &> file

Because you need to take (time ls) as a single command so you can use braces.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download