Tente isto:
#!/bin/bash
find ${PATH//:/ } -type f -executable 2>/dev/null | while read -r c; do
ldd "$c" | grep -q -m 1 libX11.so
[[ ${PIPESTATUS[1]} -eq 0 ]] && echo "${c##*/}"
done
Consulte: man find
, help while
, help read
, man ldd
, man grep
, man bash