This is a simple tips for some one who does not have UNIX background. It is easy to calculate time taken by a command, script or application to finish running in shell. The command is called time. It displays the clock time, CPU time spent on kernel mode and user mode by default.
The syntax is,
$ time <your command with arguments>
The following example shows time taken by du -sh command (to calculate the disk space occupied by current directory).
$ time du -sh .60G .real 0m5.297suser 0m0.070ssys 0m0.460s
It has taken 5.297 seconds to complete. CPU has spent 0.07 seconds on user mode and 0.46 seconds on kernel mode. This command is handy while trying to improve the performance of the applications.
For more about time command, try man time in your terminal.