time find /home -name "filename"
real 0m16.365s
user 0m0.208s
sys 0m0.492s
The time command simply receives whatever program you pass it along with all the parameters you give it and gives you back some statistics about the program execution.
If you read the manual page you can see that time can tell you a lot more than just excecution time of program/commands.
In BASH the way to make time give you other values in other formats it to set up the "TIMEFORMAT" environment variable before calling time. For example to get the above time values plus the CPU percentage we use:
export TIMEFORMAT="%E real,%U user,%S sys, %P cpu"
time find /home -name "*.txt"
7.184 real,0.292 user,0.504 sys, 11.08 cpu
Note that the man page method (i.e. -f switch) does not work with the version of Bash that comes with Ubuntu Server and Kubuntu Edgy/Feisty.
No comments:
Post a Comment