How to get the execution time of any command in Linux
Overview
The time command is used to determine the amount of time it takes for a command to run. time prints a summary of real time, user time, and sys or system time spent while executing the given command.
realtime refers to the wall clock time taken from the start to the finish of the command.usertime refers to the amount of CPU time spent in executing the command in user mode.sys/systemtime refers to the amount of CPU time spent in executing the command in kernel mode.
Syntax
time COMMAND_TO_EXECUTE
For example, time sleep 5 or time echo "hello".
Example
time sleep 2