3

I run the command copied from the time's manual, but it complained -f command not found. Why it recognized -f as a command?

$ time -f "%E real,%U user,%s sys" ls -Fs
-f: command not found

real    0m0.152s
user    0m0.108s
sys 0m0.040s

I doubt the shell and decide to try another shell. In the above, the shell is bash. I switched to dash and found time run correctly now.

My system is Linux Mint 13.

4 Answers 4

6

time is a built-in command in bash and zsh. If you'd like to execute the external command instead, you should call /usr/bin/time -f ....

5

You can use the bash built-in command to suppress shell functions and built-ins:

command time -f "%E real,%U user,%s sys" ls -Fs

(Longer, but a little more explicit, than using \time.)

4

Bash includes a stripped-down version of time. Use /usr/bin/time instead.

3

Added to other answers, you can override the built-in command by \.

\time -f "%E real,%U user,%s sys" ls -Fs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.