When writing new software or implementing new algorithms it is always nice to know how long it takes to process a certain data set. Alternatively it is just good to know how much time a program consumed when you let it run overnight. Did it take till 7 am in the morning or was it finished five minutes after you left your desk.
Linux has a very straighforward way to time your applications. The command is simply called time.
Simply put time in front of your program or script when calling in and you well get some information regarding the runtime it took.
Some examples:
Suppose you have a script called 'script.sh' and you want to time it,
time sh script.sh
will do the trick.
Same goes for programs, suppose your program is called 'program' you can time it by using:
time ./program
The output of the program will look like this:
real 0m3.759s
user 0m3.510s
sys 0m0.130s
With real being the actual time that has passed in your universe, a.k.a wall-clock time and user and sys being the time that the processor has been busy. If there are large differences between real time and user time, this means that IO is forming a bottle-neck in your application.