I want to measure execution time of commands and get (to me) strange behavior of the time
command.
I call time
like it is mentioned in the examples of the manpages with the -f
or --format
option and get a command not found
error. Seems like it thinks -f
is the command to measure the execution time of...
user@laptop:~$ time -f '%e' sleep 1
-f: Befehl nicht gefunden.
Then I call the same line again, just that I specify the path to time
. Result changes, works as intended (wtf?):
user@laptop:~$ /usr/bin/time -f '%e' sleep 1
1.00
Now I'm confused... even which
can't help me:
user@pc:~$ which time
/usr/bin/time
And... if I don't use options it works fine, even without full path:
user@laptop:~$ time sleep 1
real 0m1.003s
user 0m0.001s
sys 0m0.002s
How do I use this command correctly if I want to specify options? Using the full path seems to work, but looks more like an unreliable side effect of something buggy (or something I don't understand)?
Edit: I'm using Ubuntu 14.04 LTS (trusty)