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
The reason why redirection does not seem to work with time is that it's a bash reserved word (not a builtin!) when used in front of a pipeline. bash(1):
If the time reserved word precedes a pipeline, the elapsed as well as user and system time consumed by its execution are reported when the pipeline terminates.
So, to redirect output of time, either use curly braces:
{ time ls; } 2> filename
Or call /usr/bin/time:
/usr/bin/time ls 2> filename