I tried to measure execution time and format it with this command:
time -f "%e" ./1 1000 1 -f: command not found real 0m0.066s user 0m0.044s sys 0m0.023s
But such command works:
/usr/bin/time -f "%e" ./1 1000 1 31245 212 443 0.00
I tried to determine where another time is located, but all showes to /usr/bin/time
which time /usr/bin/time
or
whereis time time: /usr/bin/time /usr/bin/X11/time /usr/include/time.h /usr/share/man/man7/time.7.gz /usr/share/man/man2/time.2.gz /usr/share/man/man1/time.1.gz
or
type -a time time is a shell keyword time is /usr/bin/time
How to define where another time is located?
Advertisement
Answer
Users of the bash shell need to use an explicit path in order to run the external time command and not the shell builtin variant. On system where time is installed in /usr/bin, the first example would become
/usr/bin/time wc /etc/hosts
OR
Note: some shells (e.g., bash(1)) have a built-in time command that provides less functionality than the command described here. To access the real command, you may need to specify its pathname (something like /usr/bin/time).