How can I redirect the output of the "time" command?
no need to launch sub shell. Use a code block will do as well.
{ time ls; } 2> out.txt
or
{ time ls > /dev/null 2>&1 ; } 2> out.txt
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.