1

I am running very simple command:

[tester@centos-lvm ~]$ time cal > /dev/null

real    0m0.001s
user    0m0.000s
sys     0m0.001s

However, if I specify full path to the time executable I get different output:

[tester@centos-lvm ~]$ /usr/bin/time cal > /dev/null
0.00user 0.00system 0:00.00elapsed ?%CPU (0avgtext+0avgdata 928maxresident)k
0inputs+0outputs (0major+272minor)pagefaults 0swaps

I believe when I run time (without path) the /usr/bin/time is actually executed:

[tester@centos-lvm ~]$ which time
/usr/bin/time

man time tells that there are two different output formats, the -p option chooses between them. But I have not specified any options! I checked aliases, nothing there about time.

This behavior is quite unexpected and very strange. Could someone explain why and how this happens?

3

When you use time without a path, it's likely that you use a utility that is provided to you by a shell built-in (see the manual for your particular shell). When specifying a path, you are definitely using an external utility.

These two may differ in their implementation and in what output they produce.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.