Ubuntu – How to measure the execution time of a terminal process

command lineperformance

I'm trying to measure the execution time of a process that I call via the command line (i.e., I want to find out how long it takes to for the process to finish). Is there any command that I can add to the command calling the process that will achieve this?

Best Answer

Add time before the command you want to measure. For example: time ls.

The output will look like:

real    0m0.606s
user    0m0.000s
sys     0m0.002s

Explanation on real, user and sys (from man time):

  • real: Elapsed real (wall clock) time used by the process, in seconds.
  • user: Total number of CPU-seconds that the process used directly (in user mode), in seconds.
  • sys: Total number of CPU-seconds used by the system on behalf of the process (in kernel mode), in seconds.