Tag Archives: ldd

ldd.sh

On numerous occasions, I need to find the direct shared library dependencies (for ELF ofcourse), and not what ldd(1) outputs. And at all those occasions, I’d to RTFM objdump(1) everytime, and now since I plan to ditch laziness, here is a script which I wrote:

#!/bin/sh

if [ -n "$1" ]; then
	objdump --all-headers $1|awk '/^[[:space:]]*NEEDED/ { print "'$1' "$2; }'
else
	echo Usage: $0 file.so
fi

Obligatory screenshot:

chateau.d.if!abbe [~] % ldd.sh /bin/ls
/bin/ls libutil.so.9
/bin/ls libncurses.so.8
/bin/ls libc.so.7

HTH