April 3, 2019
2min Read
Edward S.
The Linux terminal is one of the most powerful tools in all computing. In it, we can execute various important administration operations. With it, we can measure how long it takes for a command to run. That’s why, in this post, we will teach how to use the Linux time command.
The Linux Time command is a command used to determine the execution time of 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 find out about their execution in the processor. Normally, the Linux time command is used to measure the performance of commands associated with services managed by the network.
First, we have to connect to our VPS using SSH. If you’re having trouble, check out our PuTTY tutorial!
Then, we can execute the following command to show the command information in the terminal.
man time
The basic syntax of the Linux time command is as follows:
time [-options] command
It looks the same on any Unix based system. Let’s break the syntax down:
To verify the time it takes for a command to run, for example, to verify the contents of the root folder, we would do it by typing in this string into the command line:
time ls -l /
As we can see, at the end of the execution of the command, there are three results:
There are several options that modify the behavior of the time command. A useful option is to export the results to a text file. We can do this with the -o option. However, first, we’ll need to create the file. We can do this with the touch command:
touch output.txt
Next, run the time command with the -o option.
time ls -l / -o output.txt
Using this method, we can carefully examine how long it takes for a command to run.
The Time command is a simple-to-use command that lets you know how long it takes for a process to run. This utility gives us valuable insights into the performance of our servers, networks, or machines. This is a must-have tool in the arsenal of any networking expert or system administrator.
We recommend you to learn more about this command with the help of the manual available in the terminal. Good luck!
Leave a reply