One of my earliest mistakes at the console was thinking the
time command was going to serve me the current time. Of course, what I got was
kmandla@jk7h5f1: ~$ time real 0m0.000s user 0m0.000s sys 0m0.000s
What I didn’t know then, and what you probably already know now, is that
time isn’t a redirect toward the current time — that’s date.
time is more of a timer, and actually is one of those things I use quite often. Probably because there are quite a few time-consuming tools that don’t, for whatever reason, offer some sort of summary at their conclusion. 👿
time sudo dd if=/dev/zero of=/dev/sda
is one. I’m sure you can think of one or two more. 😉
For what it’s worth, there’s a small discrepancy between GNU time, which could be in your system at /usr/bin/time, and the bash function named
time. Their output is obviously different but functionally similar; one or the other is undoubtedly available to you.
And as a final note, you might have
times in your system, which monitors the user and system times that have accumulated for the shell and every child process since its start.
times supposedly reports everything in clock ticks and probably isn’t useful, except for extreme cases.
kmandla@jk7h5f1: ~$ times 0m0.010s 0m0.003s 0m0.037s 0m0.007s
I can’t think of a time when I ever used
times, although there were many times when I used
time. 🙄 You knew you weren’t getting out of here without a few puns. … 😉