How to use the Linux Time command

access_time
hourglass_empty

Terminal Linux is one of the most powerful tools of information technology system. In this terminal, we can carry out many important administrative activities. And with this terminal, we can measure the time a command runs. That is why, in this article, we will show you how to use the Linux Time command.

What is Linux Time Command?

Linux Time is a command used to determine the time to perform a specific operation. Thanks to this command, we can know the exact duration of a process in any Linux operating system.

In addition, we can learn about their implementation in the processor. Typically, Linux Time is used to measure the performance of commands related to services that are managed by the network.

First, we have to connect with VPS by SSH. If you have problems, please review PuTTY instructions ours!

After that, we can execute the command below to display the command information in the terminal.

man time

The basic syntax of the Linux Time command is as follows:

time (-options) command

The syntax is the same on Unix-based systems. Explain each part as follows:

  • time - indicates the use of the command
  • (-options) - allows us to add modifiers to the command
  • command - is where we enter what we want to see

To verify the command runtime, for example, to verify the contents of the root directory, we do this by entering this Linux command:

time ls -l /

As we can see, at the end of the command execution, there were three results:

  • Real - relating to the time elapsed between the execution and the completion of the command
  • User - is the time the user spends on the processor
  • Sys - the time the system (kernel) uses to run the command

There are several options that modify the behavior of the time command. A useful option is to export the results to a text file using the option -o. However, first, we need to create the file using the command touch:

touch output.txt

Next, run the time command with the option -o.

time ls -l / -o output.txt

Using this method, we can carefully check how long it takes for a command to run.

Conclude

Linux Time is an easy to use command that helps you know how long it takes for a process to run. This utility provides us valuable insights on the performance of servers, networks or machines. This is a must-have tool in any network expert or system administrator.

We recommend that you learn more about the Linux Time command with instructions in the terminal. Good luck!

About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://www.nguyendiep.com/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment