Want to know how long a process runs and a whole lot more? The Linux
time command returns time statistics, giving you cool insights into the resources used by your programs.
time Has Many Relatives
There are many Linux distributions and different Unix-like operating systems. Each of these has a default command shell. The most common default shell in modern Linux distributions is the bash shell. But there are many others, such as the Z shell (zsh) and the Korn shell (ksh).
All of these shells incorporate their own
time command, either as a built-in command or as a reserved word. When you type
time in a terminal window the shell will execute its internal command instead of using the GNU
time binary which is provided as part of your Linux distribution.
We want to use the GNU version of
time because it has more options and is more flexible.
Which time Will Run?
You can check which version will run by using the
type will let you know whether the shell will handle your instruction itself, with its internal routines, or pass it on to the GNU binary.
in a terminal window type the word
type, a space, and then the word
time and hit Enter.
We can see that in the bash shell
time is a reserved word. This means Bash will use its internal
time routines by default.