The Stack Overflow podcast is back! Listen to an interview with our new CEO.
1 of 4

Why full path to executable affects output?

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?