Shell

確定 FreeBSD 中 /sbin/init 和 /bin/sh 使用的庫

  • September 29, 2022

如何確定FreeBSD中使用/sbin/init的庫或庫?/bin/sh它是動態連結的還是靜態的?

使用fileldd

$ file /bin/sh
/bin/sh: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.1, FreeBSD-style, stripped
$ ldd /bin/sh
/bin/sh:
       libedit.so.8 => /lib/libedit.so.8 (0x80108d000)
       libc.so.7 => /lib/libc.so.7 (0x8010c8000)
       libncursesw.so.9 => /lib/libncursesw.so.9 (0x8014d2000)
$ file /sbin/init
/sbin/init: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, for FreeBSD 13.1, FreeBSD-style, stripped
$ ldd /sbin/init
ldd: /sbin/init: not a dynamic ELF executable

/bin/sh是動態連結的,並且/sbin/init(毫不奇怪)是靜態連結的。

引用自:https://unix.stackexchange.com/questions/719171