Writing only timing statistics output of Timer to File

I'm running long integrations on a remote server, and I'm working in terminal in a tcsh shell.

I'm looking to write ONLY the timing statistics to a file.

For example:
$time ls >timer.out
writes both the files in my current directory & the timer statistics to the file timer.out.
I only want: 0.001u 0.004s 0:00.46 0.0% 0+0k 1+1io 0pf+0w in the file.

Any help would be greatly appreciated.

Welcome to the forum.

Are you sure of getting the timer statistics in file? I doubt it.
Behavior of time varies with shells.

If you have GNU time, life would be easier, just use the actual path of the command

( /usr/bin/time ls ) 1 > /dev/null 2 > timer.out

With tcsh built-in time, the following should work,

( time ls > /dev/tty ) > & timer.out

If you dont want the "ls" out-put at all (neither STDOUT nor timer.out)

( time ls > /dev/null ) > & timer.out

Hope it helps.

1 Like

'( time ls > /dev/null ) > & timer.out' works perfectly.

I've been attempting to solve this problem for quite a while...thank you for your response.