#!/bin/bash # note this works for both a.out and ELF executables filelist=$(xargs file 2>/dev/null | grep "executable" | cut -d: -f1) for f in $filelist; do ldd $f | grep '=>' | awk '{ print $1 }' done | sort -u | xargs -r -n 1 basename | sort -u