Why is the file /bin/false so large?

Smoot Carl-Mitchell smoot at tic.com
Tue Feb 9 16:46:20 UTC 2010


On Tue, 2010-02-09 at 13:16 +0100, Loïc Grenié wrote:
> 2010/2/9 Detlef Lechner <Detlef.Lechner at gmx.net>:
> > Hi,
> >
> > why is the file /bin/false so large (30260 bytes) for providing so
> > little functionality (according to 'man false'?
> 
>    This is mostly due to the initialization necessary for argument
>   parsing and environment (even though it is not necessary for true
>   or false, it is done as for generic programs) and for dynamic
>   library linking.
> 
>     You can substitute it with the much smaller
> 
> #!/bin/sh
> exit 1
> 
>   or, for true,
> 
> #!/bin/sh
> exit 0
> 
>   You can also try variants:
> 
> #!/bin/sh -c :
> 
>   or even
> 
> #!/bin/sh
> 
>   for true,
> 
> #!/usr/bin/[ -z 1 ]
> 
>   for false (but it's longer)...

30K is large???  These days that is tiny.

You could do the above shell substitutions, but the command will run
slower, since it has to load and execute the shell to only execute an
exit statement.


-- 
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005




More information about the ubuntu-users mailing list