Gnu时间和格式输出

时间:2012-03-15 07:35:21

标签: linux gnu

我想用gnu时间测量一些小.c程序的运行时间。在这个男人中写道:

-f FORMAT, --format FORMAT
Use FORMAT as the format string that controls the output of time.  See the below more information.

然后在示例中我们有:

To run the command `ls -Fs' and show just the user, system, and total time:
time -f "%E real,%U user,%S sys" ls -Fs

但是当我尝试从示例中发出此命令时,我得到:

time -f '%E real,%U user,%S sys' ls -Fs
-f: command not found

real    0m0.134s
user    0m0.084s
sys     0m0.044s

我想知道问题出在哪里,我在哪里弄错了?我只是想显示用户时间,这就是为什么我玩弄时间输出格式。

1 个答案:

答案 0 :(得分:13)

Bash for one有一个名为time的内置shell。克服它的一种方法是输入/usr/bin/time。另一种方式是alias time=/usr/bin/time。另一方面,bash builtin尊重环境变量TIMEFORMAT