文件详细信息,如下:
------------------------------------------------------------------------------------------
root@/# ls -l /bin/sh
-r-xr-xr-x 4 root root 95480 Mar 26 2006 /bin/sh
root@/# ls -l /sbin/sh
-r-xr-xr-x 2 root root 302544 Mar 26 2006 /sbin/sh
root@/# ls -l /usr/bin/sh
-r-xr-xr-x 4 root root 95480 Mar 26 2006 /usr/bin/sh
------------------------------------------------------------------------------------------
file执行如下:
------------------------------------------------------------------------------------------
root@/# file /bin/sh
/bin/sh: ELF 32-bit MSB executable SPARC Version 1, dynamically
linked, stripped
root@/# file /sbin/sh
/sbin/sh: ELF 32-bit MSB executable SPARC Version 1, statically
linked, stripped
root@/# file /usr/bin/sh
/usr/bin/sh: ELF 32-bit MSB executable SPARC Version 1, dynamically
linked, stripped
------------------------------------------------------------------------------------------
链接动态库信息,如下:
------------------------------------------------------------------------------------------
root@/# ldd /bin/sh
libgen.so.1 => /usr/lib/libgen.so.1
libsecdb.so.1 => /usr/lib/libsecdb.so.1
libnsl.so.1 => /usr/lib/libnsl.so.1
libc.so.1 => /usr/lib/libc.so.1
libcmd.so.1 => /usr/lib/libcmd.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Fire-V890/lib/libc_psr.so.1
root@/# ldd /sbin/sh
ldd: /sbin/sh: file is not a dynamic executable or shared object
root@/# ldd /usr/bin/sh
libgen.so.1 => /usr/lib/libgen.so.1
libsecdb.so.1 => /usr/lib/libsecdb.so.1
libnsl.so.1 => /usr/lib/libnsl.so.1
libc.so.1 => /usr/lib/libc.so.1
libcmd.so.1 => /usr/lib/libcmd.so.1
libdl.so.1 => /usr/lib/libdl.so.1
libmp.so.2 => /usr/lib/libmp.so.2
/usr/platform/SUNW,Sun-Fire-V890/lib/libc_psr.so.1
------------------------------------------------------------------------------------------
动态链接的bin执行的时候使用共享的libraries.他们的文件更小,而且当
libraries更新的时候,他们自动使用更新的libaries。
静态链接bin包含了所有的代码,不需要使用共享的libraries. 他们的文件大小
比动态链接的bin文件要大。
如果系统 "broken"并且libraries被删除了,损坏了,或者/usr目录没被
mounted,/sbin/sh仍然可以执行。所以推荐大家使用/sbin/sh 作为缺省的root
shell。