user1445709 user1445709 - 1 month ago 6
Linux Question

Why is /bin/true 27168 bytes in size?

ls -l /bin/true
shows it being 27168 bytes in size, whereas a c program that just returns 0 is much smaller. Also, running
objdump -d /bin/true
gives a huge assembly program with many system calls. Why is all this needed for a program that just "does nothing successfully"?

Answer

Because apart from returning 0 it also handles help and version options, plus it contains some comments inside.

You can figure it by yourself by cloning the sources from Github, and looking at the content of coreutils/src/true.c.

Comments