0

I am a beginner for Unix and I am trying do the following things:

time ls

This cmd will display the result of ls and timestamp on the screen. I can put the result of "ls" into a file by

time ls > ls_result.out

Or I can put both results of ls and time into a file by

(time ls) > both.out

But I want to know how can I separate them and put result of time command into a single file?

fedorqui
  • 275,237
  • 103
  • 548
  • 598
BobW
  • 1
  • 1

1 Answers1

0
(time ls > ls_out ) 2> time_out
Hambone
  • 15,600
  • 8
  • 46
  • 69
Muposat
  • 1,476
  • 1
  • 11
  • 24
  • I tried this, but it is said "badly placed () 's". Thanks, – BobW Jan 08 '16 at 19:09
  • @BobW It worked for me on Cygwin Bash. Your shell might be other than bash -- try `echo $0` to see which one you are using. I can also try it on Linux tonight. Meanwhile, the link to a duplicate of this question on top has some very good answers, you should check it out. – Muposat Jan 08 '16 at 21:38