Linux tutorial: /usr/bin/time -f "time: %E" command explanation

/usr/bin/time -f "time: %E"is a command line command used to display the execution time of a command in a custom format on Linux systems. This command uses the GNU time tool instead of the shell's built-in time command.

Explain the meaning of each part:

  • /usr/bin/time: This is the path to the GNU time tool. On most Linux systems, the executable file for the time tool is located at /usr/bin/time.

  • -f "time: %E": This is an option of the time tool, which -frepresents the specified format and "time: %E"is a time format string. In this example, %Eis part of a formatted string that displays the actual time elapsed.

    • %E: Indicates that the actual time consumed is displayed in the format of "[[hours:]minutes:]seconds".

So when you run /usr/bin/time -f "time: %E"a command, it will execute the following commands and display the execution time of the command in a custom format of "time: XX:XX:XX" where XX represents the hours, minutes and seconds of the actual time .

For example, if you run the following command:

/usr/bin/time -f "time: %E" sleep 5

It will output results similar to the following:

time: 0:00:05

This means that sleep 5the command took 5 seconds of actual time to run.

Supongo que te gusta

Origin blog.csdn.net/a772304419/article/details/133039991
Recomendado
Clasificación