The command "time" report a execution time information
time sleep 1
Output:
real 0m1.001s
user 0m0.000s
sys 0m0.001s
Description:
You can measure execution time by subtraction start date and end date:
start=`date +%s`
commands...
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
If you need to have more accurate measure:
start=`date +%s%N`
commands...
end=`date +%s%N`
echo Execution time was `expr $end - $start` nanoseconds.
Adding %N to date +%s causes nanosecond accuracy.
Was this information helpful to you? You have the power to keep it alive.
Each donated € will be spent on running and expanding this page about UNIX Shell.
We prepared for you video course Marian's BASH Video Training: Mastering Unix Shell, if you would like to get much more information.
Thank you. Marian Knezek