5 ms·
Run these commands for a better demonstration: time echo | sleep 1 vs. /usr/bin/time echo | sleep 1 The former times the entire pipeline whereas the
by jcoffland 10y ago
Run these commands for a better demonstration:
time echo | sleep 1
vs.
/usr/bin/time echo | sleep 1
The former times the entire pipeline whereas the later only times the first command in the pipe.
- fnord123 10y agoThis also gives the time of the entire pipeline (since the commands all begin together and only finish when the last command has completed): echo | /usr/bin/time sleep 1
- roblabla 10y agoI'm pretty sure this is wrong. As an example : sleep 2 | /usr/bin/time sleep 1 This gives an output of "1 second" even though the entire pipeline took 2 seconds.
- exprA 10y agoThe sleep sub-process of time is not part of the pipeline, however. It will exit after the requested time has passed.