Operating System - HP-UX
1839550 Members
2363 Online
110147 Solutions
New Discussion

commands have different size

 
SOLVED
Go to solution
Piero_2
New Member

commands have different size

Hi there,

have anybody an idea why the commands included in /sbin are bigger than the similar ones in /usr/bin?
Have a look at chmod and ls, for example.

Tks in advance.

Piero
6 REPLIES 6
Pete Randall
Outstanding Contributor
Solution

Re: commands have different size

The commands in /sbin are statically linked - that is everything is included so that when you boot in single user mode, the commands will run while /usr is not mounted. The commands in /usr/bin are dynamically linked and require shared libraries in order to execute - not possible in single user mode.


Pete

Pete
Peter Godron
Honored Contributor

Re: commands have different size

Peter Godron
Honored Contributor

Re: commands have different size

Piero,
sorry for the follow-up. (No points please)

You can check this yourself with:
$ file /usr/bin/ls /sbin/ls
/usr/bin/ls: PA-RISC1.1 shared executable dynamically linked
/sbin/ls: PA-RISC1.1 shared executable
spex
Honored Contributor

Re: commands have different size

Hi Piero,

'ldd' will also demonstrate the difference between statically- and dynamically-linked files:

# ldd /sbin/cat
ldd: "/sbin/cat" is not a shared executable.
# ldd /usr/bin/cat
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2

PCS
Gary Cantwell
Honored Contributor

Re: commands have different size

Hi Piero,

Please take a moment to assign points to those who have taken the time to assist you, here's how:

http://forums1.itrc.hp.com/service/forums/bizsupport/helptips.do?#33

Thanks,

Gary
Piero_2
New Member

Re: commands have different size

Thanks to everyone for the support.