time command in Linux with examples
time command in Linux is used to execute a command and prints a summary of real-time, user CPU time and system CPU time spent by executing a command when it terminates. ‘real‘ time is the time elapsed wall clock time taken by a command to get executed, while ‘user‘ and ‘sys‘ time are the number of CPU seconds that command uses in user and kernel mode respectively.
time [option] [COMMAND]
In the above example, sleep 3 is used to create a dummy job which lasts 3 seconds.
- time -p : This option is used to print time in POSIX format.
- help time : it displays help information.