Operating System - HP-UX
1752525 Members
4599 Online
108788 Solutions
New Discussion юеВ

Re: difference between /usr/bin/sh and /sbin/sh

 
SOLVED
Go to solution
ralf klausch
Advisor

difference between /usr/bin/sh and /sbin/sh

Hello,

can anybody tell me the difference between:
-r-xr-xr-x 2 bin bin 221184 Jan 20 2000 /usr/bin/sh

-r-xr-xr-x 1 bin bin 421888 Jan 20 2000 /sbin/sh

make this any sence ?

thanks in advance

regards

ralf
6 REPLIES 6
Alan Riggs
Honored Contributor
Solution

Re: difference between /usr/bin/sh and /sbin/sh

Shells under /usr are dynamicaly linked.

/sbin/sh is statically linked so that it will be available situations where non / filesystems are unavailable/umounted. that is why it should be the default root shell.
Tony Constantine_1
Regular Advisor

Re: difference between /usr/bin/sh and /sbin/sh

/sbin/sh is staticlly link (libraries are linked into the binary)

where as /usr/sbin/sh is dynamic (no libraries)thus it is smaller

you need /sbin/sh in singler user mode as /usr is not mounted thus no libraries are available
Steffi Jones_1
Esteemed Contributor

Re: difference between /usr/bin/sh and /sbin/sh

Hello,

just in addition to Alan's reply:

If you boot into single user mode you will not have /usr mounted nor will you have access to the libraries.

Make sure, that you have /sbin/sh for root in the /etc/passwd file. If you happen to enter /usr/sbin/sh in there your system won't boot up, because it will never find a shell.

Steffi Jones
ralf klausch
Advisor

Re: difference between /usr/bin/sh and /sbin/sh

thank you all for you fast response.

ralf
CHRIS ANORUO
Honored Contributor

Re: difference between /usr/bin/sh and /sbin/sh

The files in /sbin are used most for minimal system boot up processing when //usr, /var, /opt, etc are not mounted. Progammes under /usr/bin are used when the system is in a run state greater that 1.
Programmes in /usr directory are mostly called and used by the system in a stable state. You will notice that, the programmes in /usr/sbin are linked to /sbin.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Wodisch
Honored Contributor

Re: difference between /usr/bin/sh and /sbin/sh

Hello Klaus,

there is another difference, for the reasons mentioned
above:
the "/sbin/sh" does NOT start with a history, for the
simple reason of not writing to the file system you might
be fsck-ing in single-user-mode (root-fs, that is).
In multi-user-mode you can safely switch on history.
HTH,
Wodisch