How can I redirect the output of the “time” command?

前端 未结 7 1524
甜味超标
甜味超标 2020-11-30 19:19

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
相关标签:
7条回答
  • 2020-11-30 19:47

    If you don't want to mix output from time and the command. With GNU time, you can use -o file like:

    /usr/bin/time -o tim grep -e k /tmp 1>out 2>err
    

    while tim is output of time, out and err are stdout and stderr from grep.

    0 讨论(0)
提交回复
热议问题