How to Use the time Command on Linux


Linux PC with a terminal window openFatmawati Achmad Zaenuri/Shutterstock.com

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 command. 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.

type time

type time in a bash terminal window

We can see that in the bash shell time is a reserved word. This means Bash will use its internaltime routines by default.

type time

type time in a zsh terminal window

Read the remaining 46 paragraphs

Source: https://www.howtogeek.com/415977/how-to-use-the-time-command-on-linux/
Proactive Computing found this story and shared it with you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.