Measure time of program execution
The time command in Linux is used to determine the duration of execution of a command. This command is useful when you want to know the exection time of a command or a script. By default, three times are displayed:
- real time – the total execution time. This is the time elapsed between invocation and termination of the command.
- user CPU time – the CPU time used by your process.
- system CPU time – the CPU time used by the system on behalf of your process.
Here is an example. The following command will report how long it took to execute the find ./* -name “*file*” command:
The time command can also be used to track the execution time of scripts:
Geek University recommends the following video course to get you started with Linux.