'Track the time a command takes in UNIX/LINUX?
In UNIX/LINUX, is there an easy way to track the time a command takes?
Solution 1:[1]
Solution 2:[2]
Use
/usr/bin/time
instead that the time builtin in the bash: it is more configurable AFAIK.
e.g. /usr/bin/time --format=' \n---- \nelapsed time is %e'ls
Solution 3:[3]
Here is how a sleep of one second looks like, timed with time:
$ time sleep 1
real 0m1.001s
user 0m0.000s
sys 0m0.000s
Solution 4:[4]
The command time is built-in in the bash but it can also be installed on most distros by installing the package "time" (apt install time) and must be accessed by doing /usr/bin/time.
Using /usr/bin/time offers more convenient options like specifying a format:
time --format="Duration: %e seconds" sleep 3
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paolo |
| Solution 2 | Paolinux |
| Solution 3 | Guillaume Chevalier |
| Solution 4 | Jarchiii |
