How to determine execution time of a command in Linux?

Sometimes, while working on the command line in Linux, you might find yourself in a situation where-in you need to know the amount of time a particular command has consumed (from launch to finish).

If you are new to Linux, and are looking for a way to do this, you'll be glad to know that there exists a command-line tool that does exactly what you want. The tool in question is 'time', and in this tutorial we will briefly discuss how to use it.

Please note that all instructions and examples mentioned here have been tested on Ubuntu 14.04 with Bash version 4.3.11(1).

Linux time command

According to the tool's man page, time runs programs and summarizes system resource usage. By default, the command produces time-related information.

Using the tool is very easy - all you have to do is to pass your command as input to the 'time' command.

time [command]

For example:

time wget


The output of the time command is highlighted at the bottom. 'real' time is the elapsed wall clock time taken by the wget command, while 'user' and 'sys' times are the number of CPU-seconds that 'wget' used in user and kernel mode, respectively.

To learn more about the time command, head to its man page.

Leave a Comment